@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.js CHANGED
@@ -229,6 +229,7 @@ var ActorInfo = {
229
229
  name: "\u6587\u5FC3\u4E00\u8A00",
230
230
  domain: "wenxin.baidu.com",
231
231
  path: "/",
232
+ device: Device.Mobile,
232
233
  share: {
233
234
  mode: "custom",
234
235
  prefix: "",
@@ -2162,6 +2163,7 @@ var RuntimeEnv = {
2162
2163
 
2163
2164
  // src/apify-kit.js
2164
2165
  var logger3 = createInternalLogger("ApifyKit");
2166
+ var hasFleetAtHomeFlag = () => String(process.env.FLEET_AT_HOME || "").trim() !== "";
2165
2167
  var resolveRuntimeContext = (input) => {
2166
2168
  const rememberedState = RuntimeEnv.peekRememberedState();
2167
2169
  const state2 = rememberedState || RuntimeEnv.parseInput(input || {});
@@ -2262,6 +2264,13 @@ async function createApifyKit() {
2262
2264
  let lastPage = null;
2263
2265
  const getRuntimeContext = () => resolveRuntimeContext(actorInput);
2264
2266
  return {
2267
+ /**
2268
+ * 判断当前是否运行在受管自动化环境中。
2269
+ * Apify 云端保持使用 SDK 原生判断;本地 Chromium Cluster 使用 FLEET_AT_HOME 标记。
2270
+ */
2271
+ isAtHome() {
2272
+ return Actor2.isAtHome() || hasFleetAtHomeFlag();
2273
+ },
2265
2274
  /**
2266
2275
  * 核心封装:执行步骤,带自动日志确认、失败截图处理和重试机制
2267
2276
  *
@@ -5274,7 +5283,7 @@ var DefaultLaunch = {
5274
5283
  log: logOptions = null,
5275
5284
  runInHeadfulMode = false,
5276
5285
  debugMode = false,
5277
- isRunningOnApify = false,
5286
+ isRunningAtHome = false,
5278
5287
  launcher = null,
5279
5288
  preNavigationHooks = [],
5280
5289
  postNavigationHooks = [],
@@ -5323,7 +5332,7 @@ var DefaultLaunch = {
5323
5332
  };
5324
5333
  const crawlerBaseOptions = {
5325
5334
  ...DEFAULT_CRAWLER_BASE_OPTIONS,
5326
- headless: !runInHeadfulMode || isRunningOnApify,
5335
+ headless: !runInHeadfulMode || isRunningAtHome,
5327
5336
  // 有 core.fingerprint 时走固定回放;否则退回 Crawlee 默认指纹模式。
5328
5337
  browserPoolOptions: replayBrowserPoolOptions || {
5329
5338
  useFingerprints: true,
@@ -5700,7 +5709,7 @@ var CloakLaunch = {
5700
5709
  log: logOptions = null,
5701
5710
  debugMode = false,
5702
5711
  runInHeadfulMode = false,
5703
- isRunningOnApify = false,
5712
+ isRunningAtHome = false,
5704
5713
  launcher = null,
5705
5714
  runtimeState = null,
5706
5715
  fingerprintPlatform = "",
@@ -5716,7 +5725,7 @@ var CloakLaunch = {
5716
5725
  const normalizedCloakOptions = normalizeObject2(cloakOptions);
5717
5726
  const activeBrowsers = /* @__PURE__ */ new Set();
5718
5727
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
5719
- const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5728
+ const defaultArgs = isRunningAtHome ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5720
5729
  const replayContext = resolveReplayableCloakProfile(runtimeState, {
5721
5730
  fingerprintPlatform,
5722
5731
  cloakOptions: normalizedCloakOptions
@@ -5730,7 +5739,7 @@ var CloakLaunch = {
5730
5739
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
5731
5740
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
5732
5741
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
5733
- const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningOnApify;
5742
+ const headless = hasOwn(normalizedCloakOptions, "headless") ? normalizedCloakOptions.headless : !runInHeadfulMode || isRunningAtHome;
5734
5743
  const enableByPassLogger = Boolean(logOptions && logOptions.enable);
5735
5744
  const mergedCloakOptions = {
5736
5745
  ...normalizedCloakOptions,