@bluelibs/runner 4.6.0-alpha.1 → 4.6.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.
@@ -225,6 +225,7 @@ __name(loadAsyncLocalStorageClass, "loadAsyncLocalStorageClass");
225
225
  // src/platform/adapters/node.ts
226
226
  var NodePlatformAdapter = class {
227
227
  constructor() {
228
+ this.id = "node";
228
229
  this.setTimeout = globalThis.setTimeout;
229
230
  this.clearTimeout = globalThis.clearTimeout;
230
231
  }
@@ -280,6 +281,7 @@ var NodePlatformAdapter = class {
280
281
  // src/platform/adapters/browser.ts
281
282
  var BrowserPlatformAdapter = class {
282
283
  constructor() {
284
+ this.id = "browser";
283
285
  this.setTimeout = globalThis.setTimeout;
284
286
  this.clearTimeout = globalThis.clearTimeout;
285
287
  }
@@ -345,6 +347,10 @@ var BrowserPlatformAdapter = class {
345
347
 
346
348
  // src/platform/adapters/edge.ts
347
349
  var EdgePlatformAdapter = class extends BrowserPlatformAdapter {
350
+ constructor() {
351
+ super(...arguments);
352
+ this.id = "edge";
353
+ }
348
354
  static {
349
355
  __name(this, "EdgePlatformAdapter");
350
356
  }
@@ -357,6 +363,7 @@ var EdgePlatformAdapter = class extends BrowserPlatformAdapter {
357
363
  // src/platform/adapters/universal-generic.ts
358
364
  var GenericUniversalPlatformAdapter = class {
359
365
  constructor() {
366
+ this.id = "universal";
360
367
  this.setTimeout = globalThis.setTimeout;
361
368
  this.clearTimeout = globalThis.clearTimeout;
362
369
  }
@@ -400,7 +407,8 @@ var GenericUniversalPlatformAdapter = class {
400
407
  }
401
408
  return () => {
402
409
  tgt.removeEventListener?.("beforeunload", handlers.before);
403
- if (handlers.visibility) tgt.removeEventListener?.("visibilitychange", handlers.visibility);
410
+ if (handlers.visibility)
411
+ tgt.removeEventListener?.("visibilitychange", handlers.visibility);
404
412
  };
405
413
  }
406
414
  return () => {
@@ -454,6 +462,7 @@ function detectEnvironment() {
454
462
  __name(detectEnvironment, "detectEnvironment");
455
463
  var UniversalPlatformAdapter = class {
456
464
  constructor() {
465
+ this.id = "universal";
457
466
  this.inner = null;
458
467
  this.setTimeout = globalThis.setTimeout;
459
468
  this.clearTimeout = globalThis.clearTimeout;
@@ -555,7 +564,7 @@ var platformInstance = null;
555
564
  function getPlatform() {
556
565
  if (!platformInstance) {
557
566
  platformInstance = createPlatformAdapter();
558
- detectEnvironment();
567
+ platformInstance.id;
559
568
  }
560
569
  return platformInstance;
561
570
  }
@@ -2610,18 +2619,7 @@ var EventManager = class {
2610
2619
  }
2611
2620
  const frame = { id: eventDefinition.id, source };
2612
2621
  const processEmission = /* @__PURE__ */ __name(async () => {
2613
- const pseudoForExclude = {
2614
- id: eventDefinition.id,
2615
- data,
2616
- timestamp: /* @__PURE__ */ new Date(),
2617
- source,
2618
- meta: eventDefinition.meta || {},
2619
- stopPropagation: /* @__PURE__ */ __name(() => {
2620
- }, "stopPropagation"),
2621
- isPropagationStopped: /* @__PURE__ */ __name(() => false, "isPropagationStopped"),
2622
- tags: eventDefinition.tags
2623
- };
2624
- const excludeFromGlobal = this.isExcludedFromGlobal(pseudoForExclude);
2622
+ const excludeFromGlobal = globalTags.excludeFromGlobalHooks.exists(eventDefinition);
2625
2623
  const allListeners = excludeFromGlobal ? this.listeners.get(eventDefinition.id) || [] : this.getCachedMergedListeners(eventDefinition.id);
2626
2624
  let propagationStopped = false;
2627
2625
  const event = {
@@ -2748,21 +2746,8 @@ var EventManager = class {
2748
2746
  if (this.globalListeners.length === 0) {
2749
2747
  return false;
2750
2748
  }
2751
- const pseudoEmission = {
2752
- id: eventDefinition.id,
2753
- data: void 0,
2754
- timestamp: /* @__PURE__ */ new Date(),
2755
- source: "",
2756
- meta: eventDefinition.meta || {},
2757
- stopPropagation: /* @__PURE__ */ __name(() => {
2758
- }, "stopPropagation"),
2759
- isPropagationStopped: /* @__PURE__ */ __name(() => false, "isPropagationStopped"),
2760
- tags: eventDefinition.tags
2761
- };
2762
- if (this.isExcludedFromGlobal(pseudoEmission)) {
2763
- return false;
2764
- }
2765
- return true;
2749
+ const isExcludedFromGlobal = globalTags.excludeFromGlobalHooks.exists(eventDefinition);
2750
+ return !isExcludedFromGlobal;
2766
2751
  }
2767
2752
  /**
2768
2753
  * Adds an interceptor for all event emissions
@@ -4163,9 +4148,8 @@ var RunResult = class {
4163
4148
  };
4164
4149
 
4165
4150
  // src/run.ts
4166
- var platform3 = getPlatform();
4167
4151
  async function run(resourceOrResourceWithConfig, options) {
4168
- await platform3.init();
4152
+ await getPlatform().init();
4169
4153
  const {
4170
4154
  debug = void 0,
4171
4155
  logs = {},
@@ -4176,7 +4160,7 @@ async function run(resourceOrResourceWithConfig, options) {
4176
4160
  runtimeCycleDetection = true
4177
4161
  } = options || {};
4178
4162
  const {
4179
- printThreshold = platform3.getEnv("NODE_ENV") === "test" ? null : "info",
4163
+ printThreshold = getPlatform().getEnv("NODE_ENV") === "test" ? null : "info",
4180
4164
  printStrategy = "pretty",
4181
4165
  bufferLogs = false
4182
4166
  } = logs;