@skrillex1224/playwright-toolkit 3.0.24 → 3.0.26

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/index.js CHANGED
@@ -229,7 +229,6 @@ var ActorInfo = {
229
229
  name: "\u6587\u5FC3\u4E00\u8A00",
230
230
  domain: "wenxin.baidu.com",
231
231
  path: "/",
232
- device: Device.Mobile,
233
232
  share: {
234
233
  mode: "custom",
235
234
  prefix: "",
@@ -2796,6 +2795,7 @@ var RuntimeEnv = {
2796
2795
 
2797
2796
  // src/apify-kit.js
2798
2797
  var logger3 = createInternalLogger("ApifyKit");
2798
+ var hasFleetAtHomeFlag = () => String(process.env.FLEET_AT_HOME || "").trim() !== "";
2799
2799
  var resolveRuntimeContext = (input) => {
2800
2800
  const rememberedState = RuntimeEnv.peekRememberedState();
2801
2801
  const state2 = rememberedState || RuntimeEnv.parseInput(input || {});
@@ -2896,6 +2896,13 @@ async function createApifyKit() {
2896
2896
  let lastPage = null;
2897
2897
  const getRuntimeContext = () => resolveRuntimeContext(actorInput);
2898
2898
  return {
2899
+ /**
2900
+ * 判断当前是否运行在受管自动化环境中。
2901
+ * Apify 云端保持使用 SDK 原生判断;本地 Chromium Cluster 使用 FLEET_AT_HOME 标记。
2902
+ */
2903
+ isAtHome() {
2904
+ return Actor2.isAtHome() || hasFleetAtHomeFlag();
2905
+ },
2899
2906
  /**
2900
2907
  * 核心封装:执行步骤,带自动日志确认、失败截图处理和重试机制
2901
2908
  *
@@ -5908,7 +5915,7 @@ var DefaultLaunch = {
5908
5915
  log: logOptions = null,
5909
5916
  runInHeadfulMode = false,
5910
5917
  debugMode = false,
5911
- isRunningOnApify = false,
5918
+ isRunningAtHome = false,
5912
5919
  launcher = null,
5913
5920
  preNavigationHooks = [],
5914
5921
  postNavigationHooks = [],
@@ -5957,7 +5964,7 @@ var DefaultLaunch = {
5957
5964
  };
5958
5965
  const crawlerBaseOptions = {
5959
5966
  ...DEFAULT_CRAWLER_BASE_OPTIONS,
5960
- headless: !runInHeadfulMode || isRunningOnApify,
5967
+ headless: !runInHeadfulMode || isRunningAtHome,
5961
5968
  // 有 core.fingerprint 时走固定回放;否则退回 Crawlee 默认指纹模式。
5962
5969
  browserPoolOptions: replayBrowserPoolOptions || {
5963
5970
  useFingerprints: true,
@@ -6334,7 +6341,7 @@ var CloakLaunch = {
6334
6341
  log: logOptions = null,
6335
6342
  debugMode = false,
6336
6343
  runInHeadfulMode = false,
6337
- isRunningOnApify = false,
6344
+ isRunningAtHome = false,
6338
6345
  launcher = null,
6339
6346
  runtimeState = null,
6340
6347
  fingerprintPlatform = "",
@@ -6350,7 +6357,7 @@ var CloakLaunch = {
6350
6357
  const normalizedCloakOptions = normalizeObject2(cloakOptions);
6351
6358
  const activeBrowsers = /* @__PURE__ */ new Set();
6352
6359
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
6353
- const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
6360
+ const defaultArgs = isRunningAtHome ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
6354
6361
  const replayContext = resolveReplayableCloakProfile(runtimeState, {
6355
6362
  fingerprintPlatform,
6356
6363
  cloakOptions: normalizedCloakOptions
@@ -6364,7 +6371,7 @@ var CloakLaunch = {
6364
6371
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
6365
6372
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
6366
6373
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
6367
- const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningOnApify;
6374
+ const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningAtHome;
6368
6375
  const enableByPassLogger = Boolean(logOptions && logOptions.enable);
6369
6376
  const mergedCloakOptions = {
6370
6377
  ...normalizedCloakOptions,