@midscene/cli 0.30.4 → 0.30.5-beta-20251017073249.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.
package/dist/es/index.mjs CHANGED
@@ -3024,9 +3024,7 @@ var __webpack_modules__ = {
3024
3024
  "./src/index.ts": function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
3025
3025
  var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
3026
3026
  var main_default = /*#__PURE__*/ __webpack_require__.n(main);
3027
- var package_namespaceObject = {
3028
- i8: "0.30.4"
3029
- };
3027
+ var package_namespaceObject = JSON.parse('{"i8":"0.30.5-beta-20251017073249.0"}');
3030
3028
  class Node {
3031
3029
  value;
3032
3030
  next;
@@ -3155,33 +3153,34 @@ var __webpack_modules__ = {
3155
3153
  });
3156
3154
  async function createYamlPlayer(file, script, options) {
3157
3155
  const yamlScript = script || parseYamlScript((0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync)(file, 'utf-8'), file);
3156
+ const clonedYamlScript = structuredClone(yamlScript);
3158
3157
  const fileName = basename(file, extname(file));
3159
3158
  const preference = {
3160
3159
  headed: null == options ? void 0 : options.headed,
3161
3160
  keepWindow: null == options ? void 0 : options.keepWindow,
3162
3161
  testId: fileName
3163
3162
  };
3164
- const player = new ScriptPlayer(yamlScript, async ()=>{
3163
+ const player = new ScriptPlayer(clonedYamlScript, async ()=>{
3165
3164
  const freeFn = [];
3166
- const webTarget = yamlScript.web || yamlScript.target;
3165
+ const webTarget = clonedYamlScript.web || clonedYamlScript.target;
3167
3166
  const targetCount = [
3168
3167
  void 0 !== webTarget,
3169
- void 0 !== yamlScript.android,
3170
- void 0 !== yamlScript.ios,
3171
- void 0 !== yamlScript.interface
3168
+ void 0 !== clonedYamlScript.android,
3169
+ void 0 !== clonedYamlScript.ios,
3170
+ void 0 !== clonedYamlScript.interface
3172
3171
  ].filter(Boolean).length;
3173
3172
  if (targetCount > 1) {
3174
3173
  const specifiedTargets = [
3175
3174
  void 0 !== webTarget ? 'web' : null,
3176
- void 0 !== yamlScript.android ? 'android' : null,
3177
- void 0 !== yamlScript.ios ? 'ios' : null,
3178
- void 0 !== yamlScript.interface ? 'interface' : null
3175
+ void 0 !== clonedYamlScript.android ? 'android' : null,
3176
+ void 0 !== clonedYamlScript.ios ? 'ios' : null,
3177
+ void 0 !== clonedYamlScript.interface ? 'interface' : null
3179
3178
  ].filter(Boolean);
3180
3179
  throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, or interface.`);
3181
3180
  }
3182
3181
  if (void 0 !== webTarget) {
3183
- var _yamlScript_agent;
3184
- if (void 0 !== yamlScript.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.");
3182
+ var _clonedYamlScript_agent;
3183
+ 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.");
3185
3184
  let localServer;
3186
3185
  let urlToVisit;
3187
3186
  if (webTarget.serve) {
@@ -3196,10 +3195,10 @@ var __webpack_modules__ = {
3196
3195
  webTarget.url = urlToVisit;
3197
3196
  }
3198
3197
  if (!webTarget.bridgeMode) {
3199
- var _yamlScript_agent1;
3198
+ var _clonedYamlScript_agent1;
3200
3199
  const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(webTarget, {
3201
3200
  ...preference,
3202
- cache: processCacheConfig(null == (_yamlScript_agent1 = yamlScript.agent) ? void 0 : _yamlScript_agent1.cache, fileName, fileName)
3201
+ cache: processCacheConfig(null == (_clonedYamlScript_agent1 = clonedYamlScript.agent) ? void 0 : _clonedYamlScript_agent1.cache, fileName, fileName)
3203
3202
  }, null == options ? void 0 : options.browser);
3204
3203
  freeFn.push(...newFreeFn);
3205
3204
  return {
@@ -3211,7 +3210,7 @@ var __webpack_modules__ = {
3211
3210
  if (webTarget.userAgent || webTarget.viewportWidth || webTarget.viewportHeight || webTarget.viewportScale || webTarget.waitForNetworkIdle || webTarget.cookie) console.warn('puppeteer options (userAgent, viewportWidth, viewportHeight, viewportScale, waitForNetworkIdle, cookie) are not supported in bridge mode. They will be ignored.');
3212
3211
  const agent = new AgentOverChromeBridge({
3213
3212
  closeNewTabsAfterDisconnect: webTarget.closeNewTabsAfterDisconnect,
3214
- cache: processCacheConfig(null == (_yamlScript_agent = yamlScript.agent) ? void 0 : _yamlScript_agent.cache, fileName, fileName)
3213
+ cache: processCacheConfig(null == (_clonedYamlScript_agent = clonedYamlScript.agent) ? void 0 : _clonedYamlScript_agent.cache, fileName, fileName)
3215
3214
  });
3216
3215
  if ('newTabWithUrl' === webTarget.bridgeMode) await agent.connectNewTabWithUrl(webTarget.url);
3217
3216
  else {
@@ -3227,11 +3226,11 @@ var __webpack_modules__ = {
3227
3226
  freeFn
3228
3227
  };
3229
3228
  }
3230
- if (void 0 !== yamlScript.android) {
3231
- var _yamlScript_agent2;
3232
- const androidTarget = yamlScript.android;
3229
+ if (void 0 !== clonedYamlScript.android) {
3230
+ var _clonedYamlScript_agent2;
3231
+ const androidTarget = clonedYamlScript.android;
3233
3232
  const agent = await agentFromAdbDevice(null == androidTarget ? void 0 : androidTarget.deviceId, {
3234
- cache: processCacheConfig(null == (_yamlScript_agent2 = yamlScript.agent) ? void 0 : _yamlScript_agent2.cache, fileName, fileName)
3233
+ cache: processCacheConfig(null == (_clonedYamlScript_agent2 = clonedYamlScript.agent) ? void 0 : _clonedYamlScript_agent2.cache, fileName, fileName)
3235
3234
  });
3236
3235
  if (null == androidTarget ? void 0 : androidTarget.launch) await agent.launch(androidTarget.launch);
3237
3236
  freeFn.push({
@@ -3243,8 +3242,8 @@ var __webpack_modules__ = {
3243
3242
  freeFn
3244
3243
  };
3245
3244
  }
3246
- if (void 0 !== yamlScript.ios) {
3247
- const iosTarget = yamlScript.ios;
3245
+ if (void 0 !== clonedYamlScript.ios) {
3246
+ const iosTarget = clonedYamlScript.ios;
3248
3247
  const agent = await agentFromWebDriverAgent({
3249
3248
  wdaPort: null == iosTarget ? void 0 : iosTarget.wdaPort,
3250
3249
  wdaHost: null == iosTarget ? void 0 : iosTarget.wdaHost
@@ -3259,9 +3258,9 @@ var __webpack_modules__ = {
3259
3258
  freeFn
3260
3259
  };
3261
3260
  }
3262
- if (void 0 !== yamlScript.interface) {
3263
- var _yamlScript_agent3;
3264
- const interfaceTarget = yamlScript.interface;
3261
+ if (void 0 !== clonedYamlScript.interface) {
3262
+ var _clonedYamlScript_agent3;
3263
+ const interfaceTarget = clonedYamlScript.interface;
3265
3264
  const moduleSpecifier = interfaceTarget.module;
3266
3265
  let finalModuleSpecifier;
3267
3266
  if (moduleSpecifier.startsWith('./') || moduleSpecifier.startsWith('../') || node_path.isAbsolute(moduleSpecifier)) {
@@ -3275,8 +3274,8 @@ var __webpack_modules__ = {
3275
3274
  const device = new DeviceClass(interfaceTarget.param || {});
3276
3275
  debug('creating agent from device', device);
3277
3276
  const agent = createAgent(device, {
3278
- ...yamlScript.agent,
3279
- cache: processCacheConfig(null == (_yamlScript_agent3 = yamlScript.agent) ? void 0 : _yamlScript_agent3.cache, fileName, fileName)
3277
+ ...clonedYamlScript.agent,
3278
+ cache: processCacheConfig(null == (_clonedYamlScript_agent3 = clonedYamlScript.agent) ? void 0 : _clonedYamlScript_agent3.cache, fileName, fileName)
3280
3279
  });
3281
3280
  freeFn.push({
3282
3281
  name: 'destroy_general_interface_agent',
@@ -11723,15 +11722,11 @@ var __webpack_modules__ = {
11723
11722
  };
11724
11723
  async function expandFilePatterns(patterns, basePath) {
11725
11724
  const allFiles = [];
11726
- const seenFiles = new Set();
11727
11725
  for (const pattern of patterns)try {
11728
11726
  const yamlFiles = await matchYamlFiles(pattern, {
11729
11727
  cwd: basePath
11730
11728
  });
11731
- for (const file of yamlFiles)if (!seenFiles.has(file)) {
11732
- seenFiles.add(file);
11733
- allFiles.push(file);
11734
- }
11729
+ for (const file of yamlFiles)allFiles.push(file);
11735
11730
  } catch (error) {
11736
11731
  console.warn(`Warning: Failed to expand pattern "${pattern}":`, error);
11737
11732
  }
@@ -11908,7 +11903,7 @@ Usage:
11908
11903
  type: 'string',
11909
11904
  description: 'Override WebDriverAgent host for iOS environments.'
11910
11905
  }
11911
- }).version('version', 'Show version number', "0.30.4").help().wrap(yargs().terminalWidth());
11906
+ }).version('version', 'Show version number', "0.30.5-beta-20251017073249.0").help().wrap(yargs().terminalWidth());
11912
11907
  const argv = await args.argv;
11913
11908
  cli_utils_debug('argv', argv);
11914
11909
  const transformedArgv = {