@midscene/cli 1.10.4-beta-20260710100314.0 → 1.10.4-beta-20260710115744.0

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.
@@ -2840,9 +2840,10 @@ var __webpack_exports__ = {};
2840
2840
  };
2841
2841
  const player = new yaml_.ScriptPlayer(clonedYamlScript, async ()=>{
2842
2842
  const freeFn = [];
2843
- const webTarget = clonedYamlScript.web || clonedYamlScript.target;
2843
+ const resolvedWebTarget = (0, yaml_.resolveWebTarget)(clonedYamlScript);
2844
+ const webTarget = resolvedWebTarget?.target;
2844
2845
  const targetCount = [
2845
- void 0 !== webTarget,
2846
+ void 0 !== resolvedWebTarget,
2846
2847
  void 0 !== clonedYamlScript.android,
2847
2848
  void 0 !== clonedYamlScript.ios,
2848
2849
  void 0 !== clonedYamlScript.harmony,
@@ -2851,17 +2852,17 @@ var __webpack_exports__ = {};
2851
2852
  ].filter(Boolean).length;
2852
2853
  if (targetCount > 1) {
2853
2854
  const specifiedTargets = [
2854
- void 0 !== webTarget ? 'web' : null,
2855
+ resolvedWebTarget?.source ?? null,
2855
2856
  void 0 !== clonedYamlScript.android ? 'android' : null,
2856
2857
  void 0 !== clonedYamlScript.ios ? 'ios' : null,
2857
2858
  void 0 !== clonedYamlScript.harmony ? 'harmony' : null,
2858
2859
  void 0 !== clonedYamlScript.computer ? 'computer' : null,
2859
2860
  void 0 !== clonedYamlScript.interface ? 'interface' : null
2860
2861
  ].filter(Boolean);
2861
- throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, harmony, computer, or interface.`);
2862
+ throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: page, browser, web, android, ios, harmony, computer, or interface.`);
2862
2863
  }
2863
2864
  if (void 0 !== webTarget) {
2864
- if (void 0 !== clonedYamlScript.target) console.warn("target is deprecated, please use web instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.");
2865
+ if (resolvedWebTarget?.source === 'target') console.warn("target is deprecated, please use page or browser instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.");
2865
2866
  let localServer;
2866
2867
  let urlToVisit;
2867
2868
  if (webTarget.serve) {
@@ -2876,6 +2877,7 @@ var __webpack_exports__ = {};
2876
2877
  webTarget.url = urlToVisit;
2877
2878
  }
2878
2879
  if (webTarget.cdpEndpoint && webTarget.bridgeMode) throw new Error('cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.');
2880
+ if ('browser' === webTarget.mode && webTarget.bridgeMode) throw new Error('[midscene] browser mode does not support bridgeMode. Use page: or web.mode: page for bridge mode.');
2879
2881
  if (webTarget.cdpEndpoint) {
2880
2882
  const cdpBrowser = options?.browser ?? await external_puppeteer_default().connect({
2881
2883
  browserWSEndpoint: webTarget.cdpEndpoint,
@@ -3520,9 +3522,9 @@ var __webpack_exports__ = {};
3520
3522
  setupContext,
3521
3523
  ...fileContextList
3522
3524
  ] : fileContextList;
3523
- const needsBrowser = allContexts.some((ctx)=>Object.keys(ctx.executionConfig.web || ctx.executionConfig.target || {}).length > 0);
3525
+ const needsBrowser = allContexts.some((ctx)=>void 0 !== (0, yaml_.resolveWebTarget)(ctx.executionConfig));
3524
3526
  if (needsBrowser && this.config.shareBrowserContext) {
3525
- const globalWebConfig = this.config.globalConfig?.web;
3527
+ const globalWebConfig = (0, yaml_.resolveWebTarget)(this.config.globalConfig ?? {})?.target;
3526
3528
  if (globalWebConfig?.cdpEndpoint) browser = await external_puppeteer_default().connect({
3527
3529
  browserWSEndpoint: globalWebConfig.cdpEndpoint,
3528
3530
  defaultViewport: null,
@@ -3560,7 +3562,7 @@ var __webpack_exports__ = {};
3560
3562
  this.results = await this.processResults(executedResults, notExecutedContexts);
3561
3563
  } finally{
3562
3564
  if (browser && !this.config.keepWindow) {
3563
- const isCdp = !!this.config.globalConfig?.web?.cdpEndpoint;
3565
+ const isCdp = !!(0, yaml_.resolveWebTarget)(this.config.globalConfig ?? {})?.target.cdpEndpoint;
3564
3566
  if (isCdp) browser.disconnect();
3565
3567
  else await browser.close();
3566
3568
  }
@@ -3571,20 +3573,6 @@ var __webpack_exports__ = {};
3571
3573
  async createFileContext(file, fileConfig, options) {
3572
3574
  const { globalConfig } = this.config;
3573
3575
  const clonedFileConfig = JSON.parse(JSON.stringify(fileConfig));
3574
- if (clonedFileConfig.target) {
3575
- clonedFileConfig.web = {
3576
- ...clonedFileConfig.target,
3577
- ...clonedFileConfig.web
3578
- };
3579
- delete clonedFileConfig.target;
3580
- }
3581
- if (globalConfig?.target) {
3582
- globalConfig.web = {
3583
- ...globalConfig.target,
3584
- ...globalConfig.web
3585
- };
3586
- delete globalConfig.target;
3587
- }
3588
3576
  const executionConfig = external_lodash_merge_default()(clonedFileConfig, globalConfig);
3589
3577
  return {
3590
3578
  file,