@skrillex1224/playwright-toolkit 3.0.23 → 3.0.25

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,6 +256,7 @@ var ActorInfo = {
256
256
  name: "\u6587\u5FC3\u4E00\u8A00",
257
257
  domain: "wenxin.baidu.com",
258
258
  path: "/",
259
+ device: Device.Mobile,
259
260
  share: {
260
261
  mode: "custom",
261
262
  prefix: "",
@@ -2190,6 +2191,7 @@ var RuntimeEnv = {
2190
2191
 
2191
2192
  // src/apify-kit.js
2192
2193
  var logger3 = createInternalLogger("ApifyKit");
2194
+ var hasFleetAtHomeFlag = () => String(process.env.FLEET_AT_HOME || "").trim() !== "";
2193
2195
  var resolveRuntimeContext = (input) => {
2194
2196
  const rememberedState = RuntimeEnv.peekRememberedState();
2195
2197
  const state2 = rememberedState || RuntimeEnv.parseInput(input || {});
@@ -2290,6 +2292,13 @@ async function createApifyKit() {
2290
2292
  let lastPage = null;
2291
2293
  const getRuntimeContext = () => resolveRuntimeContext(actorInput);
2292
2294
  return {
2295
+ /**
2296
+ * 判断当前是否运行在受管自动化环境中。
2297
+ * Apify 云端保持使用 SDK 原生判断;本地 Chromium Cluster 使用 FLEET_AT_HOME 标记。
2298
+ */
2299
+ isAtHome() {
2300
+ return Actor2.isAtHome() || hasFleetAtHomeFlag();
2301
+ },
2293
2302
  /**
2294
2303
  * 核心封装:执行步骤,带自动日志确认、失败截图处理和重试机制
2295
2304
  *
@@ -5302,7 +5311,7 @@ var DefaultLaunch = {
5302
5311
  log: logOptions = null,
5303
5312
  runInHeadfulMode = false,
5304
5313
  debugMode = false,
5305
- isRunningOnApify = false,
5314
+ isRunningAtHome = false,
5306
5315
  launcher = null,
5307
5316
  preNavigationHooks = [],
5308
5317
  postNavigationHooks = [],
@@ -5351,7 +5360,7 @@ var DefaultLaunch = {
5351
5360
  };
5352
5361
  const crawlerBaseOptions = {
5353
5362
  ...DEFAULT_CRAWLER_BASE_OPTIONS,
5354
- headless: !runInHeadfulMode || isRunningOnApify,
5363
+ headless: !runInHeadfulMode || isRunningAtHome,
5355
5364
  // 有 core.fingerprint 时走固定回放;否则退回 Crawlee 默认指纹模式。
5356
5365
  browserPoolOptions: replayBrowserPoolOptions || {
5357
5366
  useFingerprints: true,
@@ -5728,7 +5737,7 @@ var CloakLaunch = {
5728
5737
  log: logOptions = null,
5729
5738
  debugMode = false,
5730
5739
  runInHeadfulMode = false,
5731
- isRunningOnApify = false,
5740
+ isRunningAtHome = false,
5732
5741
  launcher = null,
5733
5742
  runtimeState = null,
5734
5743
  fingerprintPlatform = "",
@@ -5744,7 +5753,7 @@ var CloakLaunch = {
5744
5753
  const normalizedCloakOptions = normalizeObject2(cloakOptions);
5745
5754
  const activeBrowsers = /* @__PURE__ */ new Set();
5746
5755
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
5747
- const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5756
+ const defaultArgs = isRunningAtHome ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5748
5757
  const replayContext = resolveReplayableCloakProfile(runtimeState, {
5749
5758
  fingerprintPlatform,
5750
5759
  cloakOptions: normalizedCloakOptions
@@ -5758,7 +5767,7 @@ var CloakLaunch = {
5758
5767
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
5759
5768
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
5760
5769
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
5761
- const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningOnApify;
5770
+ const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningAtHome;
5762
5771
  const enableByPassLogger = Boolean(logOptions && logOptions.enable);
5763
5772
  const mergedCloakOptions = {
5764
5773
  ...normalizedCloakOptions,