@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.cjs CHANGED
@@ -256,7 +256,6 @@ var ActorInfo = {
256
256
  name: "\u6587\u5FC3\u4E00\u8A00",
257
257
  domain: "wenxin.baidu.com",
258
258
  path: "/",
259
- device: Device.Mobile,
260
259
  share: {
261
260
  mode: "custom",
262
261
  prefix: "",
@@ -2824,6 +2823,7 @@ var RuntimeEnv = {
2824
2823
 
2825
2824
  // src/apify-kit.js
2826
2825
  var logger3 = createInternalLogger("ApifyKit");
2826
+ var hasFleetAtHomeFlag = () => String(process.env.FLEET_AT_HOME || "").trim() !== "";
2827
2827
  var resolveRuntimeContext = (input) => {
2828
2828
  const rememberedState = RuntimeEnv.peekRememberedState();
2829
2829
  const state2 = rememberedState || RuntimeEnv.parseInput(input || {});
@@ -2924,6 +2924,13 @@ async function createApifyKit() {
2924
2924
  let lastPage = null;
2925
2925
  const getRuntimeContext = () => resolveRuntimeContext(actorInput);
2926
2926
  return {
2927
+ /**
2928
+ * 判断当前是否运行在受管自动化环境中。
2929
+ * Apify 云端保持使用 SDK 原生判断;本地 Chromium Cluster 使用 FLEET_AT_HOME 标记。
2930
+ */
2931
+ isAtHome() {
2932
+ return Actor2.isAtHome() || hasFleetAtHomeFlag();
2933
+ },
2927
2934
  /**
2928
2935
  * 核心封装:执行步骤,带自动日志确认、失败截图处理和重试机制
2929
2936
  *
@@ -5936,7 +5943,7 @@ var DefaultLaunch = {
5936
5943
  log: logOptions = null,
5937
5944
  runInHeadfulMode = false,
5938
5945
  debugMode = false,
5939
- isRunningOnApify = false,
5946
+ isRunningAtHome = false,
5940
5947
  launcher = null,
5941
5948
  preNavigationHooks = [],
5942
5949
  postNavigationHooks = [],
@@ -5985,7 +5992,7 @@ var DefaultLaunch = {
5985
5992
  };
5986
5993
  const crawlerBaseOptions = {
5987
5994
  ...DEFAULT_CRAWLER_BASE_OPTIONS,
5988
- headless: !runInHeadfulMode || isRunningOnApify,
5995
+ headless: !runInHeadfulMode || isRunningAtHome,
5989
5996
  // 有 core.fingerprint 时走固定回放;否则退回 Crawlee 默认指纹模式。
5990
5997
  browserPoolOptions: replayBrowserPoolOptions || {
5991
5998
  useFingerprints: true,
@@ -6362,7 +6369,7 @@ var CloakLaunch = {
6362
6369
  log: logOptions = null,
6363
6370
  debugMode = false,
6364
6371
  runInHeadfulMode = false,
6365
- isRunningOnApify = false,
6372
+ isRunningAtHome = false,
6366
6373
  launcher = null,
6367
6374
  runtimeState = null,
6368
6375
  fingerprintPlatform = "",
@@ -6378,7 +6385,7 @@ var CloakLaunch = {
6378
6385
  const normalizedCloakOptions = normalizeObject2(cloakOptions);
6379
6386
  const activeBrowsers = /* @__PURE__ */ new Set();
6380
6387
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
6381
- const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
6388
+ const defaultArgs = isRunningAtHome ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
6382
6389
  const replayContext = resolveReplayableCloakProfile(runtimeState, {
6383
6390
  fingerprintPlatform,
6384
6391
  cloakOptions: normalizedCloakOptions
@@ -6392,7 +6399,7 @@ var CloakLaunch = {
6392
6399
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
6393
6400
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
6394
6401
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
6395
- const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningOnApify;
6402
+ const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningAtHome;
6396
6403
  const enableByPassLogger = Boolean(logOptions && logOptions.enable);
6397
6404
  const mergedCloakOptions = {
6398
6405
  ...normalizedCloakOptions,