@xbrowser/cli 0.14.1 → 0.14.3
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/dist/cli.js +17 -2
- package/dist/daemon-main.js +17 -2
- package/dist/index.d.ts +5 -2026
- package/dist/index.js +17 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6899,8 +6899,21 @@ async function executeChain(input, options) {
|
|
|
6899
6899
|
};
|
|
6900
6900
|
const start2 = Date.now();
|
|
6901
6901
|
try {
|
|
6902
|
+
const hooks = await loadHooks();
|
|
6903
|
+
if (hooks.length > 0) {
|
|
6904
|
+
await Promise.all(hooks.map((h) => h.onBeforeCommand?.({ page: session.page, command: `${cmdName} ${subCommand}`, params: pluginParams })));
|
|
6905
|
+
}
|
|
6902
6906
|
const raw = await cmdEntry.handler(pluginParams, pluginCtx);
|
|
6903
6907
|
const duration2 = Date.now() - start2;
|
|
6908
|
+
let hookOutputs;
|
|
6909
|
+
if (hooks.length > 0) {
|
|
6910
|
+
const outputs = [];
|
|
6911
|
+
for (const h of hooks) {
|
|
6912
|
+
const output = await h.onAfterCommand?.({ page: session.page, command: `${cmdName} ${subCommand}`, params: pluginParams, result: raw, duration: duration2 });
|
|
6913
|
+
if (output) outputs.push(output);
|
|
6914
|
+
}
|
|
6915
|
+
if (outputs.length > 0) hookOutputs = outputs;
|
|
6916
|
+
}
|
|
6904
6917
|
const data = raw?.data ?? raw;
|
|
6905
6918
|
recordArchive(session.id, sessionName, {
|
|
6906
6919
|
step: results.length,
|
|
@@ -6915,7 +6928,8 @@ async function executeChain(input, options) {
|
|
|
6915
6928
|
command: `${cmdName} ${subCommand}`,
|
|
6916
6929
|
raw: cmdStr,
|
|
6917
6930
|
...ok25(data),
|
|
6918
|
-
duration: duration2
|
|
6931
|
+
duration: duration2,
|
|
6932
|
+
...hookOutputs ? { hookOutputs } : {}
|
|
6919
6933
|
});
|
|
6920
6934
|
if (type === "or") {
|
|
6921
6935
|
return {
|
|
@@ -6979,7 +6993,8 @@ async function executeChain(input, options) {
|
|
|
6979
6993
|
data: result.data,
|
|
6980
6994
|
message: result.message,
|
|
6981
6995
|
duration,
|
|
6982
|
-
tips: result.tips
|
|
6996
|
+
tips: result.tips,
|
|
6997
|
+
...result.hookOutputs ? { hookOutputs: result.hookOutputs } : {}
|
|
6983
6998
|
};
|
|
6984
6999
|
results.push(stepResult);
|
|
6985
7000
|
if (type === "and" && !result.success) {
|
package/package.json
CHANGED