@bluelibs/runner 4.6.0-alpha → 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.
@@ -12,18 +12,15 @@ var defs_exports = {};
12
12
  __export(defs_exports, {
13
13
  isOneOf: () => isOneOf,
14
14
  onAnyOf: () => onAnyOf,
15
- symbolDispose: () => symbolDispose,
16
15
  symbolEvent: () => symbolEvent,
17
16
  symbolFilePath: () => symbolFilePath,
18
17
  symbolHook: () => symbolHook,
19
- symbolIndexResource: () => symbolIndexResource,
20
18
  symbolMiddleware: () => symbolMiddleware,
21
19
  symbolMiddlewareConfigured: () => symbolMiddlewareConfigured,
22
20
  symbolOptionalDependency: () => symbolOptionalDependency,
23
21
  symbolResource: () => symbolResource,
24
22
  symbolResourceMiddleware: () => symbolResourceMiddleware,
25
23
  symbolResourceWithConfig: () => symbolResourceWithConfig,
26
- symbolStore: () => symbolStore,
27
24
  symbolTag: () => symbolTag,
28
25
  symbolTagConfigured: () => symbolTagConfigured,
29
26
  symbolTask: () => symbolTask,
@@ -56,11 +53,6 @@ var symbolOptionalDependency = Symbol.for(
56
53
  "runner.optionalDependency"
57
54
  );
58
55
  var symbolFilePath = Symbol.for("runner.filePath");
59
- var symbolDispose = Symbol.for("runner.dispose");
60
- var symbolStore = Symbol.for("runner.store");
61
- var symbolIndexResource = Symbol.for(
62
- "runner.indexResource"
63
- );
64
56
 
65
57
  // src/types/event.ts
66
58
  function onAnyOf(...defs) {
@@ -233,6 +225,7 @@ __name(loadAsyncLocalStorageClass, "loadAsyncLocalStorageClass");
233
225
  // src/platform/adapters/node.ts
234
226
  var NodePlatformAdapter = class {
235
227
  constructor() {
228
+ this.id = "node";
236
229
  this.setTimeout = globalThis.setTimeout;
237
230
  this.clearTimeout = globalThis.clearTimeout;
238
231
  }
@@ -288,6 +281,7 @@ var NodePlatformAdapter = class {
288
281
  // src/platform/adapters/browser.ts
289
282
  var BrowserPlatformAdapter = class {
290
283
  constructor() {
284
+ this.id = "browser";
291
285
  this.setTimeout = globalThis.setTimeout;
292
286
  this.clearTimeout = globalThis.clearTimeout;
293
287
  }
@@ -353,6 +347,10 @@ var BrowserPlatformAdapter = class {
353
347
 
354
348
  // src/platform/adapters/edge.ts
355
349
  var EdgePlatformAdapter = class extends BrowserPlatformAdapter {
350
+ constructor() {
351
+ super(...arguments);
352
+ this.id = "edge";
353
+ }
356
354
  static {
357
355
  __name(this, "EdgePlatformAdapter");
358
356
  }
@@ -365,6 +363,7 @@ var EdgePlatformAdapter = class extends BrowserPlatformAdapter {
365
363
  // src/platform/adapters/universal-generic.ts
366
364
  var GenericUniversalPlatformAdapter = class {
367
365
  constructor() {
366
+ this.id = "universal";
368
367
  this.setTimeout = globalThis.setTimeout;
369
368
  this.clearTimeout = globalThis.clearTimeout;
370
369
  }
@@ -408,7 +407,8 @@ var GenericUniversalPlatformAdapter = class {
408
407
  }
409
408
  return () => {
410
409
  tgt.removeEventListener?.("beforeunload", handlers.before);
411
- if (handlers.visibility) tgt.removeEventListener?.("visibilitychange", handlers.visibility);
410
+ if (handlers.visibility)
411
+ tgt.removeEventListener?.("visibilitychange", handlers.visibility);
412
412
  };
413
413
  }
414
414
  return () => {
@@ -462,6 +462,7 @@ function detectEnvironment() {
462
462
  __name(detectEnvironment, "detectEnvironment");
463
463
  var UniversalPlatformAdapter = class {
464
464
  constructor() {
465
+ this.id = "universal";
465
466
  this.inner = null;
466
467
  this.setTimeout = globalThis.setTimeout;
467
468
  this.clearTimeout = globalThis.clearTimeout;
@@ -563,7 +564,7 @@ var platformInstance = null;
563
564
  function getPlatform() {
564
565
  if (!platformInstance) {
565
566
  platformInstance = createPlatformAdapter();
566
- detectEnvironment();
567
+ platformInstance.id;
567
568
  }
568
569
  return platformInstance;
569
570
  }
@@ -755,12 +756,10 @@ var PlatformUnsupportedFunction = class extends RuntimeError {
755
756
  // src/definers/defineResource.ts
756
757
  function defineResource(constConfig) {
757
758
  const filePath = constConfig[symbolFilePath] || getCallerFile();
758
- const isIndexResource = constConfig[symbolIndexResource] || false;
759
759
  const id2 = constConfig.id;
760
760
  return {
761
761
  [symbolResource]: true,
762
762
  [symbolFilePath]: filePath,
763
- [symbolIndexResource]: isIndexResource,
764
763
  id: id2,
765
764
  dependencies: constConfig.dependencies,
766
765
  dispose: constConfig.dispose,
@@ -2620,18 +2619,7 @@ var EventManager = class {
2620
2619
  }
2621
2620
  const frame = { id: eventDefinition.id, source };
2622
2621
  const processEmission = /* @__PURE__ */ __name(async () => {
2623
- const pseudoForExclude = {
2624
- id: eventDefinition.id,
2625
- data,
2626
- timestamp: /* @__PURE__ */ new Date(),
2627
- source,
2628
- meta: eventDefinition.meta || {},
2629
- stopPropagation: /* @__PURE__ */ __name(() => {
2630
- }, "stopPropagation"),
2631
- isPropagationStopped: /* @__PURE__ */ __name(() => false, "isPropagationStopped"),
2632
- tags: eventDefinition.tags
2633
- };
2634
- const excludeFromGlobal = this.isExcludedFromGlobal(pseudoForExclude);
2622
+ const excludeFromGlobal = globalTags.excludeFromGlobalHooks.exists(eventDefinition);
2635
2623
  const allListeners = excludeFromGlobal ? this.listeners.get(eventDefinition.id) || [] : this.getCachedMergedListeners(eventDefinition.id);
2636
2624
  let propagationStopped = false;
2637
2625
  const event = {
@@ -2758,21 +2746,8 @@ var EventManager = class {
2758
2746
  if (this.globalListeners.length === 0) {
2759
2747
  return false;
2760
2748
  }
2761
- const pseudoEmission = {
2762
- id: eventDefinition.id,
2763
- data: void 0,
2764
- timestamp: /* @__PURE__ */ new Date(),
2765
- source: "",
2766
- meta: eventDefinition.meta || {},
2767
- stopPropagation: /* @__PURE__ */ __name(() => {
2768
- }, "stopPropagation"),
2769
- isPropagationStopped: /* @__PURE__ */ __name(() => false, "isPropagationStopped"),
2770
- tags: eventDefinition.tags
2771
- };
2772
- if (this.isExcludedFromGlobal(pseudoEmission)) {
2773
- return false;
2774
- }
2775
- return true;
2749
+ const isExcludedFromGlobal = globalTags.excludeFromGlobalHooks.exists(eventDefinition);
2750
+ return !isExcludedFromGlobal;
2776
2751
  }
2777
2752
  /**
2778
2753
  * Adds an interceptor for all event emissions
@@ -4173,9 +4148,8 @@ var RunResult = class {
4173
4148
  };
4174
4149
 
4175
4150
  // src/run.ts
4176
- var platform3 = getPlatform();
4177
4151
  async function run(resourceOrResourceWithConfig, options) {
4178
- await platform3.init();
4152
+ await getPlatform().init();
4179
4153
  const {
4180
4154
  debug = void 0,
4181
4155
  logs = {},
@@ -4186,7 +4160,7 @@ async function run(resourceOrResourceWithConfig, options) {
4186
4160
  runtimeCycleDetection = true
4187
4161
  } = options || {};
4188
4162
  const {
4189
- printThreshold = platform3.getEnv("NODE_ENV") === "test" ? null : "info",
4163
+ printThreshold = getPlatform().getEnv("NODE_ENV") === "test" ? null : "info",
4190
4164
  printStrategy = "pretty",
4191
4165
  bufferLogs = false
4192
4166
  } = logs;