@smoothdeploy/playwright-core 1.57.1 → 1.58.1-beta-1770452953000
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.
Potentially problematic release.
This version of @smoothdeploy/playwright-core might be problematic. Click here for more details.
- package/ThirdPartyNotices.txt +3223 -308
- package/browsers.json +21 -22
- package/lib/cli/program.js +4 -5
- package/lib/client/api.js +3 -0
- package/lib/client/browser.js +3 -5
- package/lib/client/browserContext.js +35 -0
- package/lib/client/browserType.js +4 -3
- package/lib/client/channelOwner.js +4 -3
- package/lib/client/clientInstrumentation.js +10 -0
- package/lib/client/connection.js +4 -0
- package/lib/client/elementHandle.js +3 -0
- package/lib/client/events.js +3 -0
- package/lib/client/fetch.js +3 -4
- package/lib/client/frame.js +1 -0
- package/lib/client/page.js +28 -1
- package/lib/client/pageAgent.js +64 -0
- package/lib/client/platform.js +3 -0
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/mcpBundle.js +84 -0
- package/lib/mcpBundleImpl/index.js +147 -0
- package/lib/protocol/serializers.js +5 -0
- package/lib/protocol/validator.js +92 -3
- package/lib/remote/playwrightServer.js +1 -2
- package/lib/server/agent/actionRunner.js +335 -0
- package/lib/server/agent/actions.js +128 -0
- package/lib/server/agent/codegen.js +111 -0
- package/lib/server/agent/context.js +150 -0
- package/lib/server/agent/expectTools.js +156 -0
- package/lib/server/agent/pageAgent.js +204 -0
- package/lib/server/agent/performTools.js +262 -0
- package/lib/server/agent/tool.js +109 -0
- package/lib/server/artifact.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +56 -12
- package/lib/server/bidi/bidiChromium.js +6 -11
- package/lib/server/bidi/bidiConnection.js +1 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +75 -29
- package/lib/server/bidi/bidiFirefox.js +6 -8
- package/lib/server/bidi/bidiNetworkManager.js +1 -1
- package/lib/server/bidi/bidiPage.js +39 -28
- package/lib/server/bidi/third_party/bidiProtocolCore.js +1 -0
- package/lib/server/browserContext.js +32 -25
- package/lib/server/browserType.js +12 -4
- package/lib/server/chromium/chromium.js +14 -21
- package/lib/server/chromium/chromiumSwitches.js +2 -2
- package/lib/server/chromium/crBrowser.js +22 -12
- package/lib/server/chromium/crConnection.js +0 -5
- package/lib/server/chromium/crDevTools.js +0 -2
- package/lib/server/chromium/crNetworkManager.js +43 -2
- package/lib/server/chromium/crPage.js +19 -87
- package/lib/server/codegen/javascript.js +6 -29
- package/lib/server/deviceDescriptorsSource.json +56 -56
- package/lib/server/dispatchers/browserContextDispatcher.js +3 -0
- package/lib/server/dispatchers/dispatcher.js +6 -13
- package/lib/server/dispatchers/frameDispatcher.js +1 -1
- package/lib/server/dispatchers/pageAgentDispatcher.js +96 -0
- package/lib/server/dispatchers/pageDispatcher.js +4 -0
- package/lib/server/dom.js +12 -3
- package/lib/server/electron/electron.js +5 -2
- package/lib/server/firefox/ffBrowser.js +10 -20
- package/lib/server/firefox/ffConnection.js +0 -5
- package/lib/server/firefox/ffNetworkManager.js +2 -2
- package/lib/server/firefox/ffPage.js +15 -18
- package/lib/server/firefox/firefox.js +6 -8
- package/lib/server/frameSelectors.js +9 -3
- package/lib/server/frames.js +49 -33
- package/lib/server/instrumentation.js +3 -0
- package/lib/server/network.js +50 -12
- package/lib/server/page.js +33 -89
- package/lib/server/progress.js +26 -6
- package/lib/server/recorder/recorderApp.js +79 -100
- package/lib/server/recorder.js +55 -0
- package/lib/server/registry/browserFetcher.js +6 -4
- package/lib/server/registry/index.js +172 -149
- package/lib/server/registry/oopDownloadBrowserMain.js +3 -0
- package/lib/server/screencast.js +190 -0
- package/lib/server/screenshotCompositor.js +153 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +21 -1
- package/lib/server/trace/recorder/tracing.js +21 -21
- package/lib/server/trace/viewer/traceParser.js +72 -0
- package/lib/server/trace/viewer/traceViewer.js +17 -13
- package/lib/server/utils/expectUtils.js +87 -2
- package/lib/server/utils/httpServer.js +4 -19
- package/lib/server/utils/network.js +37 -28
- package/lib/server/utils/nodePlatform.js +6 -0
- package/lib/server/videoRecorder.js +124 -0
- package/lib/server/webkit/webkit.js +4 -6
- package/lib/server/webkit/wkBrowser.js +2 -6
- package/lib/server/webkit/wkConnection.js +1 -6
- package/lib/server/webkit/wkInterceptableRequest.js +29 -1
- package/lib/server/webkit/wkPage.js +75 -46
- package/lib/utils/isomorphic/ariaSnapshot.js +60 -2
- package/lib/utils/isomorphic/lruCache.js +51 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +9 -1
- package/lib/utils/isomorphic/stringUtils.js +49 -0
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
- package/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/lib/utils/isomorphic/trace/traceModel.js +365 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
- package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +2 -0
- package/lib/utilsBundle.js +2 -5
- package/lib/utilsBundleImpl/index.js +165 -165
- package/lib/vite/htmlReport/index.html +21 -21
- package/lib/vite/recorder/assets/{codeMirrorModule-C3UTv-Ge.css → codeMirrorModule-DYBRYzYX.css} +1 -1
- package/lib/vite/recorder/assets/codeMirrorModule-DadYNm1I.js +32 -0
- package/lib/vite/recorder/assets/{index-Ri0uHF7I.css → index-BSjZa4pk.css} +1 -1
- package/lib/vite/recorder/assets/index-BhTWtUlo.js +193 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-8UJPCtp4.js +16884 -0
- package/lib/vite/{recorder/assets/codeMirrorModule-BoWUGj0J.js → traceViewer/assets/codeMirrorModule-BNr6yhVP.js} +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-Dimjuz94.js +32 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-DkmsYcws.js +32 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-DySgctgr.js +16884 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-B1vuWQsF.js +266 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-CtEsdeVH.js +266 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-D4fm31R-.js +34087 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-JtyB0yzL.js +34087 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-tEZf-LNj.js +266 -0
- package/lib/vite/traceViewer/assets/xtermModule-DDw6eROI.js +6168 -0
- package/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -0
- package/lib/vite/traceViewer/codeMirrorModule.DuST8d_k.css +344 -0
- package/lib/vite/traceViewer/defaultSettingsView.5FCqBwKs.css +3986 -0
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +1 -0
- package/lib/vite/traceViewer/index.BQs8gGhY.js +249 -0
- package/lib/vite/traceViewer/index.BVu7tZDe.css +1 -0
- package/lib/vite/traceViewer/index.BoLn624r.js +2 -0
- package/lib/vite/traceViewer/index.Bq_EaK8x.js +249 -0
- package/lib/vite/traceViewer/index.C8YVh4B5.js +2 -0
- package/lib/vite/traceViewer/index.Cr7-GRf8.js +2 -0
- package/lib/vite/traceViewer/index.G-7UhDxt.css +164 -0
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +5 -3
- package/lib/vite/traceViewer/uiMode.-Kflt2XM.css +1440 -0
- package/lib/vite/traceViewer/uiMode.BTRKnokb.js +5 -0
- package/lib/vite/traceViewer/uiMode.CEZ5RVHh.js +5 -0
- package/lib/vite/traceViewer/uiMode.CIWF23si.js +1829 -0
- package/lib/vite/traceViewer/uiMode.Wi-DvIEY.js +1829 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/vite/traceViewer/uiMode.zEH1ejvz.js +5 -0
- package/lib/vite/traceViewer/xtermModule.BKlWQB97.css +218 -0
- package/package.json +3 -1
- package/types/protocol.d.ts +738 -159
- package/types/types.d.ts +25 -38
- package/lib/vite/recorder/assets/index-DJqDAOZp.js +0 -193
|
@@ -29,6 +29,7 @@ var import_path = __toESM(require("path"));
|
|
|
29
29
|
var import_manualPromise = require("../../utils/isomorphic/manualPromise");
|
|
30
30
|
var import_network = require("../utils/network");
|
|
31
31
|
var import_zipBundle = require("../../zipBundle");
|
|
32
|
+
var import_fileUtils = require("../utils/fileUtils");
|
|
32
33
|
function log(message) {
|
|
33
34
|
process.send?.({ method: "log", params: { message } });
|
|
34
35
|
}
|
|
@@ -99,6 +100,8 @@ function downloadFile(options) {
|
|
|
99
100
|
async function main(options) {
|
|
100
101
|
await downloadFile(options);
|
|
101
102
|
log(`SUCCESS downloading ${options.title}`);
|
|
103
|
+
log(`removing existing browser directory if any`);
|
|
104
|
+
await (0, import_fileUtils.removeFolders)([options.browserDirectory]);
|
|
102
105
|
log(`extracting archive`);
|
|
103
106
|
await (0, import_zipBundle.extract)(options.zipPath, { dir: options.browserDirectory });
|
|
104
107
|
if (options.executablePath) {
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var screencast_exports = {};
|
|
30
|
+
__export(screencast_exports, {
|
|
31
|
+
Screencast: () => Screencast
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(screencast_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_utils = require("../utils");
|
|
36
|
+
var import_utils2 = require("../utils");
|
|
37
|
+
var import_videoRecorder = require("./videoRecorder");
|
|
38
|
+
var import_page = require("./page");
|
|
39
|
+
var import_registry = require("./registry");
|
|
40
|
+
class Screencast {
|
|
41
|
+
constructor(page) {
|
|
42
|
+
this._videoRecorder = null;
|
|
43
|
+
this._videoId = null;
|
|
44
|
+
this._screencastClients = /* @__PURE__ */ new Set();
|
|
45
|
+
// Aiming at 25 fps by default - each frame is 40ms, but we give some slack with 35ms.
|
|
46
|
+
// When throttling for tracing, 200ms between frames, except for 10 frames around the action.
|
|
47
|
+
this._frameThrottler = new FrameThrottler(10, 35, 200);
|
|
48
|
+
this._frameListener = null;
|
|
49
|
+
this._page = page;
|
|
50
|
+
}
|
|
51
|
+
stopFrameThrottler() {
|
|
52
|
+
this._frameThrottler.dispose();
|
|
53
|
+
}
|
|
54
|
+
setOptions(options) {
|
|
55
|
+
this._setOptions(options).catch((e) => import_utils2.debugLogger.log("error", e));
|
|
56
|
+
this._frameThrottler.setThrottlingEnabled(!!options);
|
|
57
|
+
}
|
|
58
|
+
throttleFrameAck(ack) {
|
|
59
|
+
this._frameThrottler.ack(ack);
|
|
60
|
+
}
|
|
61
|
+
temporarilyDisableThrottling() {
|
|
62
|
+
this._frameThrottler.recharge();
|
|
63
|
+
}
|
|
64
|
+
launchVideoRecorder() {
|
|
65
|
+
const recordVideo = this._page.browserContext._options.recordVideo;
|
|
66
|
+
if (!recordVideo)
|
|
67
|
+
return void 0;
|
|
68
|
+
(0, import_utils.assert)(!this._videoId);
|
|
69
|
+
this._videoId = (0, import_utils.createGuid)();
|
|
70
|
+
const outputFile = import_path.default.join(recordVideo.dir, this._videoId + ".webm");
|
|
71
|
+
const videoOptions = {
|
|
72
|
+
// validateBrowserContextOptions ensures correct video size.
|
|
73
|
+
...recordVideo.size,
|
|
74
|
+
outputFile
|
|
75
|
+
};
|
|
76
|
+
const ffmpegPath = import_registry.registry.findExecutable("ffmpeg").executablePathOrDie(this._page.browserContext._browser.sdkLanguage());
|
|
77
|
+
this._videoRecorder = new import_videoRecorder.VideoRecorder(ffmpegPath, videoOptions);
|
|
78
|
+
this._frameListener = import_utils.eventsHelper.addEventListener(this._page, import_page.Page.Events.ScreencastFrame, (frame) => this._videoRecorder.writeFrame(frame.buffer, frame.frameSwapWallTime / 1e3));
|
|
79
|
+
this._page.waitForInitializedOrError().then((p) => {
|
|
80
|
+
if (p instanceof Error)
|
|
81
|
+
this.stopVideoRecording().catch(() => {
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return videoOptions;
|
|
85
|
+
}
|
|
86
|
+
async startVideoRecording(options) {
|
|
87
|
+
const videoId = this._videoId;
|
|
88
|
+
(0, import_utils.assert)(videoId);
|
|
89
|
+
this._page.once(import_page.Page.Events.Close, () => this.stopVideoRecording().catch(() => {
|
|
90
|
+
}));
|
|
91
|
+
const gotFirstFrame = new Promise((f) => this._page.once(import_page.Page.Events.ScreencastFrame, f));
|
|
92
|
+
await this._startScreencast(this._videoRecorder, {
|
|
93
|
+
quality: 90,
|
|
94
|
+
width: options.width,
|
|
95
|
+
height: options.height
|
|
96
|
+
});
|
|
97
|
+
gotFirstFrame.then(() => {
|
|
98
|
+
this._page.browserContext._browser._videoStarted(this._page.browserContext, videoId, options.outputFile, this._page.waitForInitializedOrError());
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async stopVideoRecording() {
|
|
102
|
+
if (!this._videoId)
|
|
103
|
+
return;
|
|
104
|
+
if (this._frameListener)
|
|
105
|
+
import_utils.eventsHelper.removeEventListeners([this._frameListener]);
|
|
106
|
+
this._frameListener = null;
|
|
107
|
+
const videoId = this._videoId;
|
|
108
|
+
this._videoId = null;
|
|
109
|
+
const videoRecorder = this._videoRecorder;
|
|
110
|
+
this._videoRecorder = null;
|
|
111
|
+
await this._stopScreencast(videoRecorder);
|
|
112
|
+
await videoRecorder.stop();
|
|
113
|
+
const video = this._page.browserContext._browser._takeVideo(videoId);
|
|
114
|
+
video?.reportFinished();
|
|
115
|
+
}
|
|
116
|
+
async _setOptions(options) {
|
|
117
|
+
if (options)
|
|
118
|
+
await this._startScreencast(this, options);
|
|
119
|
+
else
|
|
120
|
+
await this._stopScreencast(this);
|
|
121
|
+
}
|
|
122
|
+
async _startScreencast(client, options) {
|
|
123
|
+
this._screencastClients.add(client);
|
|
124
|
+
if (this._screencastClients.size === 1) {
|
|
125
|
+
await this._page.delegate.startScreencast({
|
|
126
|
+
width: options.width,
|
|
127
|
+
height: options.height,
|
|
128
|
+
quality: options.quality
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async _stopScreencast(client) {
|
|
133
|
+
this._screencastClients.delete(client);
|
|
134
|
+
if (!this._screencastClients.size)
|
|
135
|
+
await this._page.delegate.stopScreencast();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class FrameThrottler {
|
|
139
|
+
constructor(nonThrottledFrames, defaultInterval, throttlingInterval) {
|
|
140
|
+
this._acks = [];
|
|
141
|
+
this._throttlingEnabled = false;
|
|
142
|
+
this._nonThrottledFrames = nonThrottledFrames;
|
|
143
|
+
this._budget = nonThrottledFrames;
|
|
144
|
+
this._defaultInterval = defaultInterval;
|
|
145
|
+
this._throttlingInterval = throttlingInterval;
|
|
146
|
+
this._tick();
|
|
147
|
+
}
|
|
148
|
+
dispose() {
|
|
149
|
+
if (this._timeoutId) {
|
|
150
|
+
clearTimeout(this._timeoutId);
|
|
151
|
+
this._timeoutId = void 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
setThrottlingEnabled(enabled) {
|
|
155
|
+
this._throttlingEnabled = enabled;
|
|
156
|
+
}
|
|
157
|
+
recharge() {
|
|
158
|
+
for (const ack of this._acks)
|
|
159
|
+
ack();
|
|
160
|
+
this._acks = [];
|
|
161
|
+
this._budget = this._nonThrottledFrames;
|
|
162
|
+
if (this._timeoutId) {
|
|
163
|
+
clearTimeout(this._timeoutId);
|
|
164
|
+
this._tick();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
ack(ack) {
|
|
168
|
+
if (!this._timeoutId) {
|
|
169
|
+
ack();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this._acks.push(ack);
|
|
173
|
+
}
|
|
174
|
+
_tick() {
|
|
175
|
+
const ack = this._acks.shift();
|
|
176
|
+
if (ack) {
|
|
177
|
+
--this._budget;
|
|
178
|
+
ack();
|
|
179
|
+
}
|
|
180
|
+
if (this._throttlingEnabled && this._budget <= 0) {
|
|
181
|
+
this._timeoutId = setTimeout(() => this._tick(), this._throttlingInterval);
|
|
182
|
+
} else {
|
|
183
|
+
this._timeoutId = setTimeout(() => this._tick(), this._defaultInterval);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
+
0 && (module.exports = {
|
|
189
|
+
Screencast
|
|
190
|
+
});
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var screenshotCompositor_exports = {};
|
|
20
|
+
__export(screenshotCompositor_exports, {
|
|
21
|
+
compositeHighlight: () => compositeHighlight,
|
|
22
|
+
cropFullWidth: () => cropFullWidth,
|
|
23
|
+
cropRegion: () => cropRegion,
|
|
24
|
+
resizeToWidth: () => resizeToWidth,
|
|
25
|
+
setPixel: () => setPixel
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(screenshotCompositor_exports);
|
|
28
|
+
var import_utilsBundle = require("../utilsBundle");
|
|
29
|
+
function setPixel(data, width, height, x, y, color) {
|
|
30
|
+
if (x < 0 || x >= width || y < 0 || y >= height)
|
|
31
|
+
return;
|
|
32
|
+
const i = (y * width + x) * 4;
|
|
33
|
+
data[i] = color.r;
|
|
34
|
+
data[i + 1] = color.g;
|
|
35
|
+
data[i + 2] = color.b;
|
|
36
|
+
data[i + 3] = 255;
|
|
37
|
+
}
|
|
38
|
+
function cropFullWidth(data, imgWidth, imgHeight, by, bh) {
|
|
39
|
+
const cw = imgWidth;
|
|
40
|
+
let ch = Math.min(imgHeight, Math.round(cw / (16 / 9)));
|
|
41
|
+
const elementCenterY = by + Math.round(bh / 2);
|
|
42
|
+
let cy = Math.max(0, elementCenterY - Math.round(ch / 2));
|
|
43
|
+
if (cy + ch > imgHeight)
|
|
44
|
+
cy = Math.max(0, imgHeight - ch);
|
|
45
|
+
ch = Math.min(imgHeight - cy, ch);
|
|
46
|
+
const cropped = Buffer.alloc(cw * ch * 4);
|
|
47
|
+
for (let row = 0; row < ch; row++) {
|
|
48
|
+
const srcOffset = (cy + row) * cw * 4;
|
|
49
|
+
const dstOffset = row * cw * 4;
|
|
50
|
+
data.copy(cropped, dstOffset, srcOffset, srcOffset + cw * 4);
|
|
51
|
+
}
|
|
52
|
+
return { data: cropped, width: cw, height: ch };
|
|
53
|
+
}
|
|
54
|
+
function resizeToWidth(src, targetWidth) {
|
|
55
|
+
if (src.width === targetWidth)
|
|
56
|
+
return src;
|
|
57
|
+
const targetHeight = Math.round(src.height * targetWidth / src.width);
|
|
58
|
+
if (targetHeight <= 0 || targetWidth <= 0)
|
|
59
|
+
return src;
|
|
60
|
+
const dst = Buffer.alloc(targetWidth * targetHeight * 4);
|
|
61
|
+
const xRatio = src.width / targetWidth;
|
|
62
|
+
const yRatio = src.height / targetHeight;
|
|
63
|
+
for (let y = 0; y < targetHeight; y++) {
|
|
64
|
+
const srcY = Math.min(Math.floor(y * yRatio), src.height - 1);
|
|
65
|
+
for (let x = 0; x < targetWidth; x++) {
|
|
66
|
+
const srcX = Math.min(Math.floor(x * xRatio), src.width - 1);
|
|
67
|
+
const si = (srcY * src.width + srcX) * 4;
|
|
68
|
+
const di = (y * targetWidth + x) * 4;
|
|
69
|
+
dst[di] = src.data[si];
|
|
70
|
+
dst[di + 1] = src.data[si + 1];
|
|
71
|
+
dst[di + 2] = src.data[si + 2];
|
|
72
|
+
dst[di + 3] = src.data[si + 3];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { data: dst, width: targetWidth, height: targetHeight };
|
|
76
|
+
}
|
|
77
|
+
function cropRegion(data, imgWidth, imgHeight, bx, by, bw, bh, dpr, padPx = 50) {
|
|
78
|
+
const pad = padPx * dpr;
|
|
79
|
+
let cx = Math.max(0, bx - pad);
|
|
80
|
+
let cy = Math.max(0, by - pad);
|
|
81
|
+
let cw = Math.min(imgWidth - cx, bw + 2 * pad);
|
|
82
|
+
let ch = Math.min(imgHeight - cy, bh + 2 * pad);
|
|
83
|
+
const targetRatio = 16 / 9;
|
|
84
|
+
if (cw / ch < targetRatio) {
|
|
85
|
+
const newCw = Math.round(ch * targetRatio);
|
|
86
|
+
const expand = newCw - cw;
|
|
87
|
+
cx = Math.max(0, cx - Math.round(expand / 2));
|
|
88
|
+
cw = Math.min(imgWidth - cx, newCw);
|
|
89
|
+
} else {
|
|
90
|
+
const newCh = Math.round(cw / targetRatio);
|
|
91
|
+
const expand = newCh - ch;
|
|
92
|
+
cy = Math.max(0, cy - Math.round(expand / 2));
|
|
93
|
+
ch = Math.min(imgHeight - cy, newCh);
|
|
94
|
+
}
|
|
95
|
+
const cropped = Buffer.alloc(cw * ch * 4);
|
|
96
|
+
for (let row = 0; row < ch; row++) {
|
|
97
|
+
const srcOffset = ((cy + row) * imgWidth + cx) * 4;
|
|
98
|
+
const dstOffset = row * cw * 4;
|
|
99
|
+
data.copy(cropped, dstOffset, srcOffset, srcOffset + cw * 4);
|
|
100
|
+
}
|
|
101
|
+
return { data: cropped, width: cw, height: ch };
|
|
102
|
+
}
|
|
103
|
+
function compositeHighlight(pngBuffer, box, viewport) {
|
|
104
|
+
const png = import_utilsBundle.PNG.sync.read(pngBuffer);
|
|
105
|
+
const { width, height, data } = png;
|
|
106
|
+
const scaleX = viewport ? width / viewport.width : 1;
|
|
107
|
+
const scaleY = viewport ? height / viewport.height : 1;
|
|
108
|
+
const bx = Math.max(0, Math.round(box.x * scaleX));
|
|
109
|
+
const by = Math.max(0, Math.round(box.y * scaleY));
|
|
110
|
+
const bw = Math.min(width - bx, Math.round(box.width * scaleX));
|
|
111
|
+
const bh = Math.min(height - by, Math.round(box.height * scaleY));
|
|
112
|
+
for (let y = 0; y < height; y++) {
|
|
113
|
+
for (let x = 0; x < width; x++) {
|
|
114
|
+
if (x >= bx && x < bx + bw && y >= by && y < by + bh)
|
|
115
|
+
continue;
|
|
116
|
+
const i = (y * width + x) * 4;
|
|
117
|
+
data[i] = data[i] * 0.5 | 0;
|
|
118
|
+
data[i + 1] = data[i + 1] * 0.5 | 0;
|
|
119
|
+
data[i + 2] = data[i + 2] * 0.5 | 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const borderColor = { r: 255, g: 0, b: 0 };
|
|
123
|
+
const dpr = Math.round(scaleX) || 1;
|
|
124
|
+
const offset = 2 * dpr;
|
|
125
|
+
const thickness = 3 * dpr;
|
|
126
|
+
const ox = bx - offset - thickness;
|
|
127
|
+
const oy = by - offset - thickness;
|
|
128
|
+
const ow = bw + (offset + thickness) * 2;
|
|
129
|
+
const oh = bh + (offset + thickness) * 2;
|
|
130
|
+
for (let t = 0; t < thickness; t++) {
|
|
131
|
+
for (let x = ox; x < ox + ow; x++)
|
|
132
|
+
setPixel(data, width, height, x, oy + t, borderColor);
|
|
133
|
+
for (let x = ox; x < ox + ow; x++)
|
|
134
|
+
setPixel(data, width, height, x, oy + oh - 1 - t, borderColor);
|
|
135
|
+
for (let y = oy; y < oy + oh; y++)
|
|
136
|
+
setPixel(data, width, height, ox + t, y, borderColor);
|
|
137
|
+
for (let y = oy; y < oy + oh; y++)
|
|
138
|
+
setPixel(data, width, height, ox + ow - 1 - t, y, borderColor);
|
|
139
|
+
}
|
|
140
|
+
const fullData = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
141
|
+
const full = resizeToWidth(cropFullWidth(fullData, width, height, by, bh), NORMALIZED_WIDTH);
|
|
142
|
+
const cropped = resizeToWidth(cropRegion(fullData, width, height, bx, by, bw, bh, dpr, 50), NORMALIZED_WIDTH);
|
|
143
|
+
return { full, cropped };
|
|
144
|
+
}
|
|
145
|
+
const NORMALIZED_WIDTH = 1280;
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
compositeHighlight,
|
|
149
|
+
cropFullWidth,
|
|
150
|
+
cropRegion,
|
|
151
|
+
resizeToWidth,
|
|
152
|
+
setPixel
|
|
153
|
+
});
|
|
@@ -61,6 +61,7 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
61
61
|
constructor() {
|
|
62
62
|
this._lastSnapshotNumber = 0;
|
|
63
63
|
this._staleStyleSheets = /* @__PURE__ */ new Set();
|
|
64
|
+
this._modifiedStyleSheets = /* @__PURE__ */ new Set();
|
|
64
65
|
this._readingStyleSheet = false;
|
|
65
66
|
const invalidateCSSGroupingRule = (rule) => {
|
|
66
67
|
if (rule.parentStyleSheet)
|
|
@@ -76,6 +77,10 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
76
77
|
this._interceptNativeMethod(window.CSSGroupingRule.prototype, "insertRule", invalidateCSSGroupingRule);
|
|
77
78
|
this._interceptNativeMethod(window.CSSGroupingRule.prototype, "deleteRule", invalidateCSSGroupingRule);
|
|
78
79
|
this._interceptNativeGetter(window.CSSGroupingRule.prototype, "cssRules", invalidateCSSGroupingRule);
|
|
80
|
+
this._interceptNativeSetter(window.StyleSheet.prototype, "disabled", (sheet) => {
|
|
81
|
+
if (sheet instanceof CSSStyleSheet)
|
|
82
|
+
this._invalidateStyleSheet(sheet);
|
|
83
|
+
});
|
|
79
84
|
this._interceptNativeAsyncMethod(window.CSSStyleSheet.prototype, "replace", (sheet) => this._invalidateStyleSheet(sheet));
|
|
80
85
|
this._fakeBase = document.createElement("base");
|
|
81
86
|
this._observer = new MutationObserver((list) => this._handleMutations(list));
|
|
@@ -148,6 +153,17 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
148
153
|
}
|
|
149
154
|
});
|
|
150
155
|
}
|
|
156
|
+
_interceptNativeSetter(obj, prop, cb) {
|
|
157
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
158
|
+
Object.defineProperty(obj, prop, {
|
|
159
|
+
...descriptor,
|
|
160
|
+
set: function(value) {
|
|
161
|
+
const result = descriptor.set.call(this, value);
|
|
162
|
+
cb(this, value);
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
151
167
|
_handleMutations(list) {
|
|
152
168
|
for (const mutation of list)
|
|
153
169
|
ensureCachedData(mutation.target).attributesCached = void 0;
|
|
@@ -156,6 +172,8 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
156
172
|
if (this._readingStyleSheet)
|
|
157
173
|
return;
|
|
158
174
|
this._staleStyleSheets.add(sheet);
|
|
175
|
+
if (sheet.href !== null)
|
|
176
|
+
this._modifiedStyleSheets.add(sheet);
|
|
159
177
|
}
|
|
160
178
|
_updateStyleElementStyleSheetTextIfNeeded(sheet, forceText) {
|
|
161
179
|
const data = ensureCachedData(sheet);
|
|
@@ -248,6 +266,8 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
248
266
|
_getSheetText(sheet) {
|
|
249
267
|
this._readingStyleSheet = true;
|
|
250
268
|
try {
|
|
269
|
+
if (sheet.disabled)
|
|
270
|
+
return "";
|
|
251
271
|
const rules = [];
|
|
252
272
|
for (const rule of sheet.cssRules)
|
|
253
273
|
rules.push(rule.cssText);
|
|
@@ -518,7 +538,7 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
518
538
|
wallTime: Date.now(),
|
|
519
539
|
collectionTime: 0
|
|
520
540
|
};
|
|
521
|
-
for (const sheet of this.
|
|
541
|
+
for (const sheet of this._modifiedStyleSheets) {
|
|
522
542
|
if (sheet.href === null)
|
|
523
543
|
continue;
|
|
524
544
|
const content = this._updateLinkStyleSheetTextIfNeeded(sheet, snapshotNumber);
|
|
@@ -222,7 +222,7 @@ class Tracing extends import_instrumentation.SdkObject {
|
|
|
222
222
|
if (!(this._context instanceof import_browserContext.BrowserContext))
|
|
223
223
|
return;
|
|
224
224
|
for (const page of this._context.pages())
|
|
225
|
-
page.
|
|
225
|
+
page.screencast.setOptions(null);
|
|
226
226
|
}
|
|
227
227
|
_allocateNewTraceFile(state) {
|
|
228
228
|
const suffix = state.chunkOrdinal ? `-chunk${state.chunkOrdinal}` : ``;
|
|
@@ -326,23 +326,21 @@ class Tracing extends import_instrumentation.SdkObject {
|
|
|
326
326
|
return { artifact };
|
|
327
327
|
}
|
|
328
328
|
async _captureSnapshot(snapshotName, sdkObject, metadata) {
|
|
329
|
-
if (!
|
|
329
|
+
if (!snapshotName || !sdkObject.attribution.page)
|
|
330
330
|
return;
|
|
331
|
-
|
|
332
|
-
return;
|
|
333
|
-
if (!this._snapshotter.started())
|
|
334
|
-
return;
|
|
335
|
-
if (!shouldCaptureSnapshot(metadata))
|
|
336
|
-
return;
|
|
337
|
-
await this._snapshotter.captureSnapshot(sdkObject.attribution.page, metadata.id, snapshotName).catch(() => {
|
|
331
|
+
await this._snapshotter?.captureSnapshot(sdkObject.attribution.page, metadata.id, snapshotName).catch(() => {
|
|
338
332
|
});
|
|
339
333
|
}
|
|
340
|
-
|
|
341
|
-
|
|
334
|
+
_shouldCaptureSnapshot(sdkObject, metadata) {
|
|
335
|
+
return !!this._snapshotter?.started() && shouldCaptureSnapshot(metadata) && !!sdkObject.attribution.page;
|
|
336
|
+
}
|
|
337
|
+
onBeforeCall(sdkObject, metadata, parentId) {
|
|
338
|
+
const event = createBeforeActionTraceEvent(metadata, parentId ?? this._currentGroupId());
|
|
342
339
|
if (!event)
|
|
343
340
|
return Promise.resolve();
|
|
344
|
-
sdkObject.attribution.page?.
|
|
345
|
-
|
|
341
|
+
sdkObject.attribution.page?.screencast.temporarilyDisableThrottling();
|
|
342
|
+
if (this._shouldCaptureSnapshot(sdkObject, metadata))
|
|
343
|
+
event.beforeSnapshot = `before@${metadata.id}`;
|
|
346
344
|
this._state?.callIds.add(metadata.id);
|
|
347
345
|
this._appendTraceEvent(event);
|
|
348
346
|
return this._captureSnapshot(event.beforeSnapshot, sdkObject, metadata);
|
|
@@ -353,8 +351,9 @@ class Tracing extends import_instrumentation.SdkObject {
|
|
|
353
351
|
const event = createInputActionTraceEvent(metadata);
|
|
354
352
|
if (!event)
|
|
355
353
|
return Promise.resolve();
|
|
356
|
-
sdkObject.attribution.page?.
|
|
357
|
-
|
|
354
|
+
sdkObject.attribution.page?.screencast.temporarilyDisableThrottling();
|
|
355
|
+
if (this._shouldCaptureSnapshot(sdkObject, metadata))
|
|
356
|
+
event.inputSnapshot = `input@${metadata.id}`;
|
|
358
357
|
this._appendTraceEvent(event);
|
|
359
358
|
return this._captureSnapshot(event.inputSnapshot, sdkObject, metadata);
|
|
360
359
|
}
|
|
@@ -369,15 +368,16 @@ class Tracing extends import_instrumentation.SdkObject {
|
|
|
369
368
|
if (event)
|
|
370
369
|
this._appendTraceEvent(event);
|
|
371
370
|
}
|
|
372
|
-
|
|
371
|
+
onAfterCall(sdkObject, metadata) {
|
|
373
372
|
if (!this._state?.callIds.has(metadata.id))
|
|
374
|
-
return;
|
|
373
|
+
return Promise.resolve();
|
|
375
374
|
this._state?.callIds.delete(metadata.id);
|
|
376
375
|
const event = createAfterActionTraceEvent(metadata);
|
|
377
376
|
if (!event)
|
|
378
|
-
return;
|
|
379
|
-
sdkObject.attribution.page?.
|
|
380
|
-
|
|
377
|
+
return Promise.resolve();
|
|
378
|
+
sdkObject.attribution.page?.screencast.temporarilyDisableThrottling();
|
|
379
|
+
if (this._shouldCaptureSnapshot(sdkObject, metadata))
|
|
380
|
+
event.afterSnapshot = `after@${metadata.id}`;
|
|
381
381
|
this._appendTraceEvent(event);
|
|
382
382
|
return this._captureSnapshot(event.afterSnapshot, sdkObject, metadata);
|
|
383
383
|
}
|
|
@@ -484,7 +484,7 @@ class Tracing extends import_instrumentation.SdkObject {
|
|
|
484
484
|
this._appendTraceEvent(event);
|
|
485
485
|
}
|
|
486
486
|
_startScreencastInPage(page) {
|
|
487
|
-
page.
|
|
487
|
+
page.screencast.setOptions(kScreencastOptions);
|
|
488
488
|
const prefix = page.guid;
|
|
489
489
|
this._screencastListeners.push(
|
|
490
490
|
import_eventsHelper.eventsHelper.addEventListener(page, import_page.Page.Events.ScreencastFrame, (params) => {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var traceParser_exports = {};
|
|
30
|
+
__export(traceParser_exports, {
|
|
31
|
+
ZipTraceLoaderBackend: () => ZipTraceLoaderBackend
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(traceParser_exports);
|
|
34
|
+
var import_url = __toESM(require("url"));
|
|
35
|
+
var import_zipFile = require("../../utils/zipFile");
|
|
36
|
+
class ZipTraceLoaderBackend {
|
|
37
|
+
constructor(traceFile) {
|
|
38
|
+
this._traceFile = traceFile;
|
|
39
|
+
this._zipFile = new import_zipFile.ZipFile(traceFile);
|
|
40
|
+
}
|
|
41
|
+
isLive() {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
traceURL() {
|
|
45
|
+
return import_url.default.pathToFileURL(this._traceFile).toString();
|
|
46
|
+
}
|
|
47
|
+
async entryNames() {
|
|
48
|
+
return await this._zipFile.entries();
|
|
49
|
+
}
|
|
50
|
+
async hasEntry(entryName) {
|
|
51
|
+
const entries = await this.entryNames();
|
|
52
|
+
return entries.includes(entryName);
|
|
53
|
+
}
|
|
54
|
+
async readText(entryName) {
|
|
55
|
+
try {
|
|
56
|
+
const buffer = await this._zipFile.read(entryName);
|
|
57
|
+
return buffer.toString("utf-8");
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async readBlob(entryName) {
|
|
62
|
+
try {
|
|
63
|
+
const buffer = await this._zipFile.read(entryName);
|
|
64
|
+
return new Blob([new Uint8Array(buffer)]);
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
ZipTraceLoaderBackend
|
|
72
|
+
});
|
|
@@ -47,20 +47,21 @@ var import_launchApp2 = require("../../launchApp");
|
|
|
47
47
|
var import_playwright = require("../../playwright");
|
|
48
48
|
var import_progress = require("../../progress");
|
|
49
49
|
const tracesDirMarker = "traces.dir";
|
|
50
|
-
function validateTraceUrl(
|
|
51
|
-
if (!
|
|
52
|
-
return
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
function validateTraceUrl(traceFileOrUrl) {
|
|
51
|
+
if (!traceFileOrUrl)
|
|
52
|
+
return traceFileOrUrl;
|
|
53
|
+
if (traceFileOrUrl.startsWith("http://") || traceFileOrUrl.startsWith("https://"))
|
|
54
|
+
return traceFileOrUrl;
|
|
55
|
+
let traceFile = traceFileOrUrl;
|
|
56
|
+
if (traceFile.endsWith(".json"))
|
|
57
|
+
return toFilePathUrl(traceFile);
|
|
57
58
|
try {
|
|
58
|
-
const stat = import_fs.default.statSync(
|
|
59
|
+
const stat = import_fs.default.statSync(traceFile);
|
|
59
60
|
if (stat.isDirectory())
|
|
60
|
-
|
|
61
|
-
return
|
|
61
|
+
traceFile = import_path.default.join(traceFile, tracesDirMarker);
|
|
62
|
+
return toFilePathUrl(traceFile);
|
|
62
63
|
} catch {
|
|
63
|
-
throw new Error(`Trace file ${
|
|
64
|
+
throw new Error(`Trace file ${traceFileOrUrl} does not exist!`);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
async function startTraceViewerServer(options) {
|
|
@@ -221,15 +222,18 @@ function traceDescriptor(traceDir, tracePrefix) {
|
|
|
221
222
|
};
|
|
222
223
|
for (const name of import_fs.default.readdirSync(traceDir)) {
|
|
223
224
|
if (!tracePrefix || name.startsWith(tracePrefix))
|
|
224
|
-
result.entries.push({ name, path: import_path.default.join(traceDir, name) });
|
|
225
|
+
result.entries.push({ name, path: toFilePathUrl(import_path.default.join(traceDir, name)) });
|
|
225
226
|
}
|
|
226
227
|
const resourcesDir = import_path.default.join(traceDir, "resources");
|
|
227
228
|
if (import_fs.default.existsSync(resourcesDir)) {
|
|
228
229
|
for (const name of import_fs.default.readdirSync(resourcesDir))
|
|
229
|
-
result.entries.push({ name: "resources/" + name, path: import_path.default.join(resourcesDir, name) });
|
|
230
|
+
result.entries.push({ name: "resources/" + name, path: toFilePathUrl(import_path.default.join(resourcesDir, name)) });
|
|
230
231
|
}
|
|
231
232
|
return result;
|
|
232
233
|
}
|
|
234
|
+
function toFilePathUrl(filePath) {
|
|
235
|
+
return `file?path=${encodeURIComponent(filePath)}`;
|
|
236
|
+
}
|
|
233
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
234
238
|
0 && (module.exports = {
|
|
235
239
|
installRootRedirect,
|