@arcgis/lumina-compiler 4.33.0-next.99 → 4.34.0-next.1

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.
@@ -1,18 +1,19 @@
1
- import { expect as p, afterEach as R } from "vitest";
2
- import { toSystemPathSeparators as V, isPosix as L } from "@arcgis/components-build-utils";
3
- import { p as _, i as h } from "../types-C3YmWTVv.js";
4
- async function S(s) {
1
+ import { expect as p, afterEach as V } from "vitest";
2
+ import { toSystemPathSeparators as L, isPosix as S } from "@arcgis/components-build-utils";
3
+ import { p as T, i as h } from "../types-C3YmWTVv.js";
4
+ import { l as y } from "../logger-KpGU2b3R.js";
5
+ async function D(s) {
5
6
  await s.exposeFunction("puppeteerOnEvent", (e, t) => {
6
- O(s._e2eEvents, e, t);
7
- }), await s.evaluateOnNewDocument(j);
7
+ j(s._e2eEvents, e, t);
8
+ }), await s.evaluateOnNewDocument(z);
8
9
  }
9
- async function D(s, e, t) {
10
- const n = new $(e), a = t !== "document" ? () => window : () => document, i = await s.evaluateHandle(a);
11
- return await C(s, i, e, (r) => {
10
+ async function O(s, e, t) {
11
+ const n = new C(e), a = t !== "document" ? () => window : () => document, i = await s.evaluateHandle(a);
12
+ return await N(s, i, e, (r) => {
12
13
  n.push(r);
13
14
  }), n;
14
15
  }
15
- async function T(s, e, t) {
16
+ async function $(s, e, t) {
16
17
  const n = await s.evaluate(
17
18
  async (a, i, r) => await new Promise((o, l) => {
18
19
  const c = setTimeout(() => {
@@ -32,7 +33,7 @@ async function T(s, e, t) {
32
33
  );
33
34
  return await s.waitForChanges(), n;
34
35
  }
35
- class $ {
36
+ class C {
36
37
  constructor(e) {
37
38
  this.eventName = e, this.events = [], this._cursor = 0, this._queuedHandler = [];
38
39
  }
@@ -69,7 +70,7 @@ class $ {
69
70
  t && t();
70
71
  }
71
72
  }
72
- async function C(s, e, t, n) {
73
+ async function N(s, e, t, n) {
73
74
  const a = s._e2eEventIds++;
74
75
  s._e2eEvents.set(a, {
75
76
  eventName: t,
@@ -87,10 +88,10 @@ async function C(s, e, t, n) {
87
88
  t
88
89
  );
89
90
  }
90
- function O(s, e, t) {
91
+ function j(s, e, t) {
91
92
  s.get(e)?.callback(t);
92
93
  }
93
- function j() {
94
+ function z() {
94
95
  const s = async () => await new Promise(requestAnimationFrame), e = window;
95
96
  let t;
96
97
  const n = new Promise((i, r) => t = r).catch((i) => {
@@ -130,9 +131,9 @@ function j() {
130
131
  isSerializedEvent: !0
131
132
  });
132
133
  }
133
- const z = globalThis.HTMLElement ?? function() {
134
+ const M = globalThis.HTMLElement ?? function() {
134
135
  };
135
- class d extends z {
136
+ class d extends M {
136
137
  constructor(e = d._page, t = d._handle) {
137
138
  super(), this._page = e, this.handle = t, this._queuedActions = [], this._temporaryDisableValidation = !1, e._e2eElements.push(this);
138
139
  const n = this.classList.add, a = this.classList.remove, i = this.classList.toggle;
@@ -182,7 +183,7 @@ class d extends z {
182
183
  * elements were found.
183
184
  */
184
185
  async find(e) {
185
- return await N(this._page, this.handle, e);
186
+ return await x(this._page, this.handle, e);
186
187
  }
187
188
  /**
188
189
  * Find all child elements that match the selector, which is the same as
@@ -194,7 +195,7 @@ class d extends z {
194
195
  * no elements were found.
195
196
  */
196
197
  async findAll(e) {
197
- return await x(this._page, this.handle, e);
198
+ return await P(this._page, this.handle, e);
198
199
  }
199
200
  /**
200
201
  * Used to call a method on a component. For example, if a component
@@ -226,8 +227,8 @@ class d extends z {
226
227
  * `expect(spy).toHaveReceivedEventDetail({...})`.
227
228
  */
228
229
  async spyOnEvent(e) {
229
- const t = new $(e);
230
- return await C(this._page, this.handle, e, (n) => {
230
+ const t = new C(e);
231
+ return await N(this._page, this.handle, e, (n) => {
231
232
  t.push(n);
232
233
  }), t;
233
234
  }
@@ -283,7 +284,7 @@ class d extends z {
283
284
  * Waits until the given event is listened in the element.
284
285
  */
285
286
  async waitForEvent(e) {
286
- return await T(this._page, e, this.handle);
287
+ return await $(this._page, e, this.handle);
287
288
  }
288
289
  /**
289
290
  * Waits until the element's style is `display !== 'none'`,
@@ -631,8 +632,8 @@ class d extends z {
631
632
  }), t;
632
633
  }
633
634
  }
634
- async function N(s, e, t) {
635
- const { lightSelector: n, text: a, contains: i } = P(t);
635
+ async function x(s, e, t) {
636
+ const { lightSelector: n, text: a, contains: i } = A(t);
636
637
  if (typeof t == "string" && t.includes(">>>")) {
637
638
  const l = await s.$(t);
638
639
  if (!l)
@@ -641,12 +642,12 @@ async function N(s, e, t) {
641
642
  return await c.e2eSync(), c;
642
643
  }
643
644
  let r;
644
- if (typeof n == "string" ? r = await e.$(n) : r = await M(s, e, a, i), !r)
645
+ if (typeof n == "string" ? r = await e.$(n) : r = await q(s, e, a, i), !r)
645
646
  return null;
646
647
  const o = d.create(s, r);
647
648
  return await o.e2eSync(), o;
648
649
  }
649
- async function M(s, e, t, n) {
650
+ async function q(s, e, t, n) {
650
651
  const a = await s.evaluateHandle(
651
652
  (i, r, o) => {
652
653
  let l = null;
@@ -676,7 +677,7 @@ async function M(s, e, t, n) {
676
677
  );
677
678
  return a ? a.asElement() : null;
678
679
  }
679
- async function x(s, e, t) {
680
+ async function P(s, e, t) {
680
681
  const n = [];
681
682
  if (typeof t == "string" && t.includes(">>>")) {
682
683
  const r = await s.$$(t, {
@@ -689,7 +690,7 @@ async function x(s, e, t) {
689
690
  }
690
691
  return n;
691
692
  }
692
- const { lightSelector: a } = P(t);
693
+ const { lightSelector: a } = A(t);
693
694
  if (a === void 0)
694
695
  return [];
695
696
  const i = await e.$$(a, {
@@ -704,7 +705,7 @@ async function x(s, e, t) {
704
705
  }
705
706
  return n;
706
707
  }
707
- function P(s) {
708
+ function A(s) {
708
709
  const e = {
709
710
  lightSelector: void 0,
710
711
  text: void 0,
@@ -720,15 +721,15 @@ function P(s) {
720
721
  throw new Error(`invalid find selector: ${JSON.stringify(s)}`);
721
722
  return e;
722
723
  }
723
- async function fe(s) {
724
- const e = await _.runner.createNewPage();
724
+ async function me(s) {
725
+ const e = await T.runner.createNewPage();
725
726
  try {
726
- return await q(e, s);
727
+ return await k(e, s);
727
728
  } catch (t) {
728
729
  throw e.isClosed() || await e.close(), t;
729
730
  }
730
731
  }
731
- async function q(s, e) {
732
+ async function k(s, e) {
732
733
  const t = [], n = {
733
734
  _e2eElements: [],
734
735
  _originalClose: s.close,
@@ -737,7 +738,7 @@ async function q(s, e) {
737
738
  _isWaitingForAllReady: !1,
738
739
  _unhandledError: void 0,
739
740
  async spyOnEvent(o, l) {
740
- return await D.call(a, a, o, l);
741
+ return await O.call(a, a, o, l);
741
742
  },
742
743
  async close(o) {
743
744
  try {
@@ -749,7 +750,7 @@ async function q(s, e) {
749
750
  }
750
751
  } catch {
751
752
  }
752
- await Promise.all(m), k(a);
753
+ await Promise.all(m), W(a);
753
754
  try {
754
755
  a.isClosed() || await a._originalClose?.(o);
755
756
  } catch {
@@ -757,41 +758,45 @@ async function q(s, e) {
757
758
  },
758
759
  async find(o) {
759
760
  const l = await r();
760
- return await N(a, l, o);
761
+ return await x(a, l, o);
761
762
  },
762
763
  async findAll(o) {
763
764
  const l = await r();
764
- return await x(a, l, o);
765
+ return await P(a, l, o);
765
766
  },
766
767
  async waitForEvent(o) {
767
768
  const l = await r();
768
- return await T(a, o, l);
769
+ return await $(a, o, l);
769
770
  },
770
771
  getDiagnostics: () => t,
771
772
  async waitForChanges(o) {
772
- await U(a, o);
773
+ await J(a, o);
773
774
  },
774
775
  async debugger() {
775
776
  if (!h.isDevToolsEnabled) {
776
- console.warn(
777
+ y.warn(
778
+ "@arcgis/lumina:puppeteer-testing",
777
779
  "Re-run the test with the --inspect flag or set `puppeteerTesting.launchOptions.devtools: true` in order to use E2EPage.debugger()"
778
780
  );
779
781
  return;
780
782
  }
781
- h.isHeadlessBrowser && console.warn("E2EPage.debugger() called while in headless mode. This may freeze the test."), await a.evaluate(
783
+ h.isHeadlessBrowser && y.warn(
784
+ "@arcgis/lumina:puppeteer-testing",
785
+ "E2EPage.debugger() called while in headless mode. This may freeze the test."
786
+ ), await a.evaluate(
782
787
  async () => await new Promise((o) => {
783
788
  debugger;
784
789
  o();
785
790
  })
786
791
  );
787
792
  },
788
- goTo: W,
789
- setContent: y,
793
+ goTo: I,
794
+ setContent: b,
790
795
  async waitForTimeout(o) {
791
796
  await new Promise((l) => setTimeout(l, o));
792
797
  }
793
798
  }, a = Object.assign(s, n);
794
- await S(a);
799
+ await D(a);
795
800
  let i;
796
801
  async function r() {
797
802
  return i ??= a.evaluateHandle(() => document), (await i).asElement();
@@ -801,7 +806,7 @@ async function q(s, e) {
801
806
  type: "error",
802
807
  message: o.text(),
803
808
  location: o.location().url
804
- }), J(o);
809
+ }), B(o);
805
810
  }), a.on("pageerror", (o) => {
806
811
  if (t.push({
807
812
  type: "pageerror",
@@ -825,15 +830,15 @@ async function q(s, e) {
825
830
  message: c,
826
831
  location: l
827
832
  }), c !== "net::ERR_ABORTED" && console.error("Request failed", { location: l, message: c });
828
- }), typeof e?.html == "string" && await y.call(a, e.html), a;
833
+ }), typeof e?.html == "string" && await b.call(a, e.html), a;
829
834
  }
830
- function k(s) {
835
+ function W(s) {
831
836
  function e() {
832
837
  throw new Error("The page was already closed");
833
838
  }
834
839
  s.goto = e, s.find = e, s.debugger = e, s.findAll = e, s.setContent = e, s.spyOnEvent = e, s.waitForChanges = e, s.waitForEvent = e;
835
840
  }
836
- async function W(s, e = {}) {
841
+ async function I(s, e = {}) {
837
842
  if (this.isClosed())
838
843
  throw new Error("e2eGoTo unavailable: page already closed");
839
844
  if (typeof s != "string")
@@ -848,7 +853,7 @@ async function W(s, e = {}) {
848
853
  throw new Error(`Testing unable to load ${s}, HTTP status: ${String(a?.status())}`);
849
854
  return await v(this, e), a;
850
855
  }
851
- async function y(s, e = {}) {
856
+ async function b(s, e = {}) {
852
857
  if (this.isClosed())
853
858
  throw new Error("Can't call e2eSetContent on a closed age");
854
859
  if (typeof s != "string")
@@ -881,7 +886,7 @@ ${s}`), a = h.devServerUrl;
881
886
  await v(this, e);
882
887
  }
883
888
  async function v(s, e) {
884
- const t = e?.timeout ?? _.runner.config.testTimeout * I;
889
+ const t = e?.timeout ?? T.runner.config.testTimeout * U;
885
890
  s._isWaitingForAllReady = !0;
886
891
  try {
887
892
  await new Promise((n, a) => {
@@ -905,8 +910,8 @@ async function v(s, e) {
905
910
  throw s._unhandledError = void 0, n;
906
911
  }
907
912
  }
908
- const I = 0.9;
909
- async function U(s, e = h.puppeteerWaitForChangesDelay ?? 0) {
913
+ const U = 0.9;
914
+ async function J(s, e = h.puppeteerWaitForChangesDelay ?? 0) {
910
915
  try {
911
916
  if (s.isClosed() || (await Promise.all(s._e2eElements.map(async (t) => await t.e2eRunActions())), s.isClosed()) || (await v(s), s.isClosed()))
912
917
  return;
@@ -917,31 +922,31 @@ async function U(s, e = h.puppeteerWaitForChangesDelay ?? 0) {
917
922
  }
918
923
  }
919
924
  const m = [];
920
- async function J(s) {
925
+ async function B(s) {
921
926
  const e = s.type();
922
927
  if (e === "debug")
923
928
  return;
924
929
  let t = "";
925
930
  if (s.args().length === 0)
926
- t = `${s.text()}${A(s)}`;
931
+ t = `${s.text()}${H(s)}`;
927
932
  else {
928
- const n = B(s);
933
+ const n = G(s);
929
934
  m.push(n), await Promise.all(m.slice(0, -1)), t = await n, m.splice(m.indexOf(n), 1);
930
935
  }
931
936
  t.startsWith("Using Calcite Components") || (typeof console[e] == "function" ? console[e](t) : console.log(e, t));
932
937
  }
933
- async function B(s) {
934
- return `${(await Promise.all(s.args().map(G))).join(" ")} ${A(s)}`;
938
+ async function G(s) {
939
+ return `${(await Promise.all(s.args().map(Y))).join(" ")} ${H(s)}`;
935
940
  }
936
- const A = (s) => [`
941
+ const H = (s) => [`
937
942
  Stack:
938
- `, s.stackTrace().map(Y).join(`
943
+ `, s.stackTrace().map(K).join(`
939
944
  `), `
940
945
  `].join("");
941
- async function G(s) {
946
+ async function Y(s) {
942
947
  const e = s.toString();
943
- if (e.startsWith(b))
944
- return e.slice(b.length);
948
+ if (e.startsWith(E))
949
+ return e.slice(E.length);
945
950
  try {
946
951
  return await s.evaluate((t) => {
947
952
  if (typeof t == "object" && t !== null) {
@@ -964,18 +969,18 @@ async function G(s) {
964
969
  s.dispose();
965
970
  }
966
971
  }
967
- const b = "JSHandle:";
968
- function Y(s) {
972
+ const E = "JSHandle:";
973
+ function K(s) {
969
974
  let e = "";
970
975
  if (s?.url) {
971
- const t = s.url.indexOf(E);
976
+ const t = s.url.indexOf(_);
972
977
  e = ` ${decodeURIComponent(
973
- t === -1 ? s.url : V(s.url.slice(t + E.length))
978
+ t === -1 ? s.url : L(s.url.slice(t + _.length))
974
979
  )}`, s.lineNumber && (e += `:${s.lineNumber}`), s.columnNumber && (e += `:${s.columnNumber}`);
975
980
  }
976
981
  return e;
977
982
  }
978
- const E = L ? "/@fs" : "/@fs/";
983
+ const _ = S ? "/@fs" : "/@fs/";
979
984
  function f(s, e) {
980
985
  if (typeof s != "object" || s === null)
981
986
  throw new Error(`${e} expect called with non-element value`);
@@ -984,7 +989,7 @@ function f(s, e) {
984
989
  if (!("getAttribute" in s) || typeof s.getAttribute != "function")
985
990
  throw new Error(`expect ${e} value is not an element`);
986
991
  }
987
- const K = (s, e, t) => {
992
+ const Q = (s, e, t) => {
988
993
  f(s, "toEqualAttribute");
989
994
  let n = s.getAttribute(e);
990
995
  t != null && (t = String(t)), n != null && (n = String(n));
@@ -993,7 +998,7 @@ const K = (s, e, t) => {
993
998
  message: () => `expected attribute ${e} to ${a ? "not " : ""}equal "${t}", but received "${n}"`,
994
999
  pass: a
995
1000
  };
996
- }, Q = (s, e) => {
1001
+ }, X = (s, e) => {
997
1002
  f(s, "toEqualAttributes");
998
1003
  const t = Object.keys(e), n = t.every((a) => {
999
1004
  let i = e[a];
@@ -1003,35 +1008,35 @@ const K = (s, e, t) => {
1003
1008
  message: () => `expected attributes to ${n ? "not " : ""}equal ${t.map((a) => `[${a}="${String(e[a])}"]`).join(", ")}`,
1004
1009
  pass: n
1005
1010
  };
1006
- }, X = (s, e) => {
1011
+ }, Z = (s, e) => {
1007
1012
  f(s, "toHaveAttribute");
1008
1013
  const t = s.hasAttribute(e);
1009
1014
  return {
1010
1015
  message: () => `expected to ${t ? "not " : ""}have the attribute "${e}"`,
1011
1016
  pass: t
1012
1017
  };
1013
- }, Z = (s, e) => {
1018
+ }, ee = (s, e) => {
1014
1019
  f(s, "toHaveClass");
1015
1020
  const t = s.classList.contains(e);
1016
1021
  return {
1017
1022
  message: () => `expected to ${t ? "not " : ""}have css class "${e}"`,
1018
1023
  pass: t
1019
1024
  };
1020
- }, H = (s, e) => {
1025
+ }, F = (s, e) => {
1021
1026
  f(s, "toHaveClasses");
1022
1027
  const t = e.every((n) => s.classList.contains(n));
1023
1028
  return {
1024
1029
  message: () => `expected to ${t ? "not " : ""}have css classes "${e.join(" ")}", but className is "${s.className}"`,
1025
1030
  pass: t
1026
1031
  };
1027
- }, ee = (s, e) => {
1032
+ }, te = (s, e) => {
1028
1033
  f(s, "toMatchClasses");
1029
- let { pass: t } = H(s, e);
1034
+ let { pass: t } = F(s, e);
1030
1035
  return t && (t = e.length === s.classList.length), {
1031
1036
  message: () => `expected to ${t ? "not " : ""}match css classes "${e.join(" ")}", but className is "${s.className}"`,
1032
1037
  pass: t
1033
1038
  };
1034
- }, te = (s) => {
1039
+ }, se = (s) => {
1035
1040
  w(s);
1036
1041
  const e = s.events.length > 0;
1037
1042
  return {
@@ -1047,14 +1052,14 @@ function w(s) {
1047
1052
  if (!("eventName" in s))
1048
1053
  throw new Error("toHaveReceivedEvent did not receive an event spy");
1049
1054
  }
1050
- const se = (s, e) => {
1055
+ const ne = (s, e) => {
1051
1056
  w(s);
1052
1057
  const t = s.length === e;
1053
1058
  return {
1054
1059
  message: () => `expected event "${s.eventName}" to have been called ${e} times, but was called ${s.events.length} time${s.events.length === 1 ? "" : "s"}`,
1055
1060
  pass: t
1056
1061
  };
1057
- }, ne = function(e, t) {
1062
+ }, ie = function(e, t) {
1058
1063
  if (w(e), e.lastEvent === void 0)
1059
1064
  throw new Error(`event "${e.eventName}" was not received`);
1060
1065
  const n = this.equals(e.lastEvent.detail, t);
@@ -1062,7 +1067,7 @@ const se = (s, e) => {
1062
1067
  message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1063
1068
  pass: n
1064
1069
  };
1065
- }, ie = function(e, t) {
1070
+ }, ae = function(e, t) {
1066
1071
  if (w(e), e.firstEvent === void 0)
1067
1072
  throw new Error(`event "${e.eventName}" was not received`);
1068
1073
  const n = this.equals(e.firstEvent.detail, t);
@@ -1070,7 +1075,7 @@ const se = (s, e) => {
1070
1075
  message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1071
1076
  pass: n
1072
1077
  };
1073
- }, ae = function(e, t) {
1078
+ }, re = function(e, t) {
1074
1079
  if (w(e), e.firstEvent === void 0)
1075
1080
  throw new Error(`event "${e.eventName}" was not received`);
1076
1081
  const n = this.equals(e.lastEvent?.detail, t);
@@ -1078,7 +1083,7 @@ const se = (s, e) => {
1078
1083
  message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1079
1084
  pass: n
1080
1085
  };
1081
- }, re = function(e, t, n) {
1086
+ }, oe = function(e, t, n) {
1082
1087
  if (w(e), e.firstEvent === void 0)
1083
1088
  throw new Error(`event "${e.eventName}" was not received`);
1084
1089
  const a = e.events[t];
@@ -1089,7 +1094,7 @@ const se = (s, e) => {
1089
1094
  message: () => `expected event "${e.eventName}" detail to ${i ? "not " : ""}equal`,
1090
1095
  pass: i
1091
1096
  };
1092
- }, oe = (s, e) => {
1097
+ }, le = (s, e) => {
1093
1098
  if (s == null)
1094
1099
  throw new Error("toEqualText expect called with nullish value");
1095
1100
  if (typeof s == "object" && "then" in s && typeof s.then == "function")
@@ -1101,30 +1106,30 @@ const se = (s, e) => {
1101
1106
  message: () => `expected textContent "${e}" to ${n ? "not " : ""}equal "${t}"`,
1102
1107
  pass: n
1103
1108
  };
1104
- }, g = /\s+/gu, le = {
1105
- toEqualAttribute: K,
1106
- toEqualAttributes: Q,
1107
- toEqualText: oe,
1108
- toHaveAttribute: X,
1109
- toHaveClass: Z,
1110
- toHaveClasses: H,
1111
- toMatchClasses: ee,
1112
- toHaveReceivedEvent: te,
1113
- toHaveReceivedEventTimes: se,
1114
- toHaveReceivedEventDetail: ne,
1115
- toHaveFirstReceivedEventDetail: ie,
1116
- toHaveLastReceivedEventDetail: ae,
1117
- toHaveNthReceivedEventDetail: re
1109
+ }, g = /\s+/gu, ce = {
1110
+ toEqualAttribute: Q,
1111
+ toEqualAttributes: X,
1112
+ toEqualText: le,
1113
+ toHaveAttribute: Z,
1114
+ toHaveClass: ee,
1115
+ toHaveClasses: F,
1116
+ toMatchClasses: te,
1117
+ toHaveReceivedEvent: se,
1118
+ toHaveReceivedEventTimes: ne,
1119
+ toHaveReceivedEventDetail: ie,
1120
+ toHaveFirstReceivedEventDetail: ae,
1121
+ toHaveLastReceivedEventDetail: re,
1122
+ toHaveNthReceivedEventDetail: oe
1118
1123
  };
1119
- function we() {
1120
- p.extend(le), R(() => {
1121
- document.body.childNodes.forEach(F);
1124
+ function pe() {
1125
+ p.extend(ce), V(() => {
1126
+ document.body.childNodes.forEach(R);
1122
1127
  });
1123
1128
  }
1124
- function F(s) {
1125
- s.childNodes.forEach(F), s.remove();
1129
+ function R(s) {
1130
+ s.childNodes.forEach(R), s.remove();
1126
1131
  }
1127
1132
  export {
1128
- fe as newE2EPage,
1129
- we as setupPuppeteerTest
1133
+ me as newE2EPage,
1134
+ pe as setupPuppeteerTest
1130
1135
  };