@arcgis/lumina-compiler 4.33.0-next.123 → 4.33.0-next.125

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.
@@ -19,6 +19,10 @@ type Chunk = {
19
19
  isAsync: boolean | undefined;
20
20
  oldSingleExportName: string | undefined;
21
21
  };
22
+ export declare function buildLoaderCode(runtimeVariableName: string, customEntrypoints: {
23
+ in: string;
24
+ out: string;
25
+ }[]): string;
22
26
  /**
23
27
  * Transform each core-importing chunk to use $arcgis.t for loading core in
24
28
  * order to be both ESM and AMD CDN compatible.
@@ -1,99 +1,105 @@
1
- import { render as y } from "lit-html";
2
- import { unsafeStatic as u, html as C } from "lit-html/static.js";
3
- import { camelToKebab as N } from "@arcgis/components-utils";
4
- import { onTestFinished as L, expect as _ } from "vitest";
5
- import S from "vitest-fail-on-console";
6
- import x from "js-beautify";
7
- import { LitElement as E } from "@arcgis/lumina";
8
- import { toFunction as O } from "@arcgis/lumina/controllers";
9
- async function W(e, { parent: t = document.body, afterConnect: n, dynamicComponents: r, cleanupAfterTest: i = !0 } = {}) {
10
- const o = document.createElement("div");
11
- o.style.display = "contents", t.append(o), i && L(() => M(o)), w(e);
12
- const s = r?.some(w);
13
- let c;
1
+ import { render as C } from "lit-html";
2
+ import { unsafeStatic as m, html as w } from "lit-html/static.js";
3
+ import { devOnly$getLitElementTagNameAndRuntime as $, LitElement as S } from "@arcgis/lumina";
4
+ import { camelToKebab as _ } from "@arcgis/components-utils";
5
+ import { onTestFinished as x, expect as E } from "vitest";
6
+ import O from "vitest-fail-on-console";
7
+ import R from "js-beautify";
8
+ import { toFunction as D } from "@arcgis/lumina/controllers";
9
+ async function G(e, { parent: t = document.body, afterConnect: o, dynamicComponents: f, cleanupAfterTest: s = !0 } = {}) {
10
+ const n = document.createElement("div");
11
+ n.style.display = "contents", t.append(n), s && x(() => j(n)), v(e);
12
+ const l = f?.some(v);
13
+ let r;
14
14
  if (typeof e == "string")
15
- c = C`<${u(e)}></${u(e)}>`;
15
+ r = w`<${m(e)}></${m(e)}>`;
16
16
  else if (typeof e == "function")
17
- c = "tagName" in e ? C`<${u(e.tagName)}></${u(e.tagName)}>` : e();
17
+ if (p(e)) {
18
+ const c = $(e).tagName;
19
+ r = w`<${m(c)}></${m(c)}>`;
20
+ } else
21
+ r = e();
18
22
  else {
19
- if (s)
23
+ if (l)
20
24
  throw new Error(
21
- 'When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static override tagName = "some-tag-name";` property with a unique tag name within the test file'
25
+ 'When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static tagName = "some-tag-name";` property with a unique tag name within the test file'
22
26
  );
23
- c = e;
27
+ r = e;
24
28
  }
25
- const l = [];
26
- function p(d) {
27
- l.push(d.error), d.preventDefault(), d.stopPropagation();
29
+ const i = [];
30
+ function a(c) {
31
+ i.push(c.error), c.preventDefault(), c.stopPropagation();
28
32
  }
29
- if (window.addEventListener("error", p), y(c, o), window.removeEventListener("error", p), l.length === 1)
30
- throw l[0];
31
- if (l.length > 1)
32
- throw new AggregateError(l, "Multiple errors occurred while creating the custom element");
33
- const a = b(o), $ = h, g = n?.(a);
34
- g?.then !== void 0 && await g;
35
- const m = a;
36
- typeof m?.componentOnReady == "function" && await m.componentOnReady();
37
- const f = m?._litElement ?? $ ?? a;
33
+ if (window.addEventListener("error", a), C(r, n), window.removeEventListener("error", a), i.length === 1)
34
+ throw i[0];
35
+ if (i.length > 1)
36
+ throw new AggregateError(i, "Multiple errors occurred while creating the custom element");
37
+ const u = L(n), N = g, y = o?.(u);
38
+ y?.then !== void 0 && await y;
39
+ const d = u;
40
+ typeof d?.componentOnReady == "function" && await d.componentOnReady();
41
+ const h = d?.$component ?? N ?? u;
38
42
  return {
39
- el: a,
40
- component: f,
43
+ el: u,
44
+ component: h,
41
45
  async reRender() {
42
- return typeof e == "function" && !("tagName" in e) && y(e(), t), f.requestUpdate(), await f.updateComplete;
46
+ return typeof e == "function" && !p(e) && C(e(), t), h.requestUpdate(), await h.updateComplete;
43
47
  },
44
- container: o
48
+ container: n
45
49
  };
46
50
  }
47
- let h;
48
- const R = globalThis;
49
- R.devOnly$luminaComponentRefCallback = (e) => {
50
- h = e;
51
+ let g;
52
+ const M = globalThis;
53
+ M.devOnly$luminaComponentRefCallback = (e) => {
54
+ g = e;
51
55
  };
52
- function M(e) {
56
+ function j(e) {
53
57
  for (; e.firstChild; )
54
58
  e.removeChild(e.firstChild);
55
59
  e instanceof HTMLElement && e.remove();
56
60
  }
57
- function w(e) {
58
- if (!j(e) || e.runtime !== void 0)
61
+ function v(e) {
62
+ if (!p(e))
59
63
  return !1;
60
- let t = !1, n = e.tagName;
61
- if (!n) {
62
- t = !1;
63
- const r = N(
64
+ const { runtime: t, tagName: o = e.tagName } = $(e);
65
+ if (t !== void 0)
66
+ return !1;
67
+ let s = !1, n = o;
68
+ if (n === void 0) {
69
+ const l = _(
64
70
  /*
65
71
  * If name is a single letter, it was probably minified - thus is not
66
72
  * stable, thus don't use it. Example: class produced by wrapController()
67
73
  */
68
74
  (e.name.length > 1 ? e.name.replaceAll(z, "") : "") || "Test"
69
- ), i = r === "test" ? "te-st" : r.includes("-") ? r : `${r}-`;
70
- n = i;
71
- for (let o = 2, s = customElements.get(n); s !== e && s !== void 0; o += 1)
72
- t = !0, n = `${i}-${o}`, s = customElements.get(n);
75
+ ), r = l === "test" ? "te-st" : l.includes("-") ? l : `${l}-`;
76
+ n = r;
77
+ for (let i = 2, a = customElements.get(n); a !== e && a !== void 0; i += 1)
78
+ s = !0, n = `${r}-${i}`, a = customElements.get(n);
73
79
  }
74
- return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), t;
80
+ return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), s;
75
81
  }
76
- const j = (e) => typeof e == "function" && "lumina" in e, z = /\d+$/gu;
77
- function b(e) {
82
+ const p = (e) => typeof e == "function" && "lumina" in e, z = /\d+$/gu;
83
+ function L(e) {
78
84
  for (const t of e.children)
79
85
  if ("lumina" in t.constructor)
80
86
  return t;
81
87
  for (const t of e.children) {
82
- const n = b(t);
83
- if (n != null)
84
- return n;
88
+ const o = L(t);
89
+ if (o != null)
90
+ return o;
85
91
  }
86
- return e.firstElementChild ?? h?.el;
92
+ return e.firstElementChild ?? g?.el;
87
93
  }
88
- function F() {
89
- _.addSnapshotSerializer({
94
+ function A() {
95
+ E.addSnapshotSerializer({
90
96
  // Using duck typing to detect ShadowRoot. Not using instanceof to keep test fast
91
97
  test(e) {
92
98
  return typeof e == "object" && e !== null && "innerHTML" in e && "onslotchange" in e;
93
99
  },
94
100
  serialize(e) {
95
- const t = e.innerHTML.replaceAll(q, "");
96
- return x.html(t, {
101
+ const t = e.innerHTML.replaceAll(F, "");
102
+ return R.html(t, {
97
103
  /* eslint-disable @typescript-eslint/naming-convention */
98
104
  indent_size: 2,
99
105
  indent_char: " ",
@@ -106,26 +112,26 @@ function F() {
106
112
  }
107
113
  });
108
114
  }
109
- const q = /<!--\??(?:lit\$\d+\$)?-->/gu;
110
- function G() {
111
- if (T[v])
115
+ const F = /<!--\??(?:lit\$\d+\$)?-->/gu;
116
+ function I() {
117
+ if (b[T])
112
118
  return;
113
- T[v] = !0;
119
+ b[T] = !0;
114
120
  const e = { ...console };
115
- S({
121
+ O({
116
122
  // Workaround for https://github.com/thomasbrodusch/vitest-fail-on-console/issues/61
117
- silenceMessage(t, n) {
118
- return e[n](t), !1;
123
+ silenceMessage(t, o) {
124
+ return e[o](t), !1;
119
125
  }
120
- }), F();
126
+ }), A();
121
127
  }
122
- const v = Symbol.for("lumina:didSetupTest"), T = globalThis;
123
- function I(e, t) {
124
- class n extends E {
128
+ const T = Symbol.for("lumina:didSetupTest"), b = globalThis;
129
+ function J(e, t) {
130
+ class o extends S {
125
131
  constructor() {
126
132
  super();
127
- const i = "prototype" in e ? O(e) : e;
128
- this.controller = i(this), Promise.resolve(t?.(this)).catch(console.error);
133
+ const s = "prototype" in e ? D(e) : e;
134
+ this.controller = s(this), Promise.resolve(t?.(this)).catch(console.error);
129
135
  }
130
136
  /*
131
137
  * Emitting controller's exports here is useful to let controller tests
@@ -137,10 +143,10 @@ function I(e, t) {
137
143
  );
138
144
  }
139
145
  }
140
- return n;
146
+ return o;
141
147
  }
142
148
  export {
143
- W as mount,
144
- G as setupLuminaTest,
145
- I as wrapController
149
+ G as mount,
150
+ I as setupLuminaTest,
151
+ J as wrapController
146
152
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina-compiler",
3
- "version": "4.33.0-next.123",
3
+ "version": "4.33.0-next.125",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -18,9 +18,9 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN LICENSE.md",
20
20
  "dependencies": {
21
- "@arcgis/api-extractor": "4.33.0-next.123",
22
- "@arcgis/components-build-utils": "4.33.0-next.123",
23
- "@arcgis/components-utils": "4.33.0-next.123",
21
+ "@arcgis/api-extractor": "4.33.0-next.125",
22
+ "@arcgis/components-build-utils": "4.33.0-next.125",
23
+ "@arcgis/components-utils": "4.33.0-next.125",
24
24
  "chalk": "^5.3.0",
25
25
  "esbuild": "^0.25.4",
26
26
  "glob": "^11.0.0",
@@ -37,6 +37,6 @@
37
37
  "vitest-fail-on-console": "^0.7.1"
38
38
  },
39
39
  "peerDependencies": {
40
- "@arcgis/lumina": "~4.33.0-next.123"
40
+ "@arcgis/lumina": "~4.33.0-next.125"
41
41
  }
42
42
  }