@arcgis/lumina-compiler 4.34.0-next.121 → 4.34.0-next.122
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 +2 -1
- package/dist/publicTypes.d.ts +1 -1
- package/dist/testing/failOnConsole.d.ts +6 -0
- package/dist/testing/index.js +77 -58
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -3003,7 +3003,7 @@ async function ta(e, t) {
|
|
|
3003
3003
|
const ia = /* @__PURE__ */ new Set([
|
|
3004
3004
|
"@arcgis/arcade-languageservice",
|
|
3005
3005
|
"@arcgis/components-build-utils",
|
|
3006
|
-
"@arcgis/
|
|
3006
|
+
"@arcgis/toolkit",
|
|
3007
3007
|
"@arcgis/core",
|
|
3008
3008
|
"@arcgis/core-adapter",
|
|
3009
3009
|
"@arcgis/languages-api-utils",
|
|
@@ -5671,6 +5671,7 @@ const ts = (e, t) => ({
|
|
|
5671
5671
|
"@arcgis/lumina",
|
|
5672
5672
|
"@arcgis/components-controllers",
|
|
5673
5673
|
"@arcgis/components-utils",
|
|
5674
|
+
"@arcgis/toolkit",
|
|
5674
5675
|
"@arcgis/core-adapter",
|
|
5675
5676
|
"@arcgis/map-components",
|
|
5676
5677
|
"@arcgis/common-components",
|
package/dist/publicTypes.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export type BuildOptions = {
|
|
|
100
100
|
* New lines are accepted.
|
|
101
101
|
* Do not include // or /* - will be added automatically.
|
|
102
102
|
*
|
|
103
|
-
* @default require("@arcgis/
|
|
103
|
+
* @default require("@arcgis/toolkit/string").getPreamble()
|
|
104
104
|
*
|
|
105
105
|
* @example
|
|
106
106
|
* ```js
|
package/dist/testing/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { render as C } from "lit";
|
|
2
2
|
import { unsafeStatic as m, html as w } from "lit/static-html.js";
|
|
3
|
-
import { devOnly$getLitElementTagNameAndRuntime as
|
|
4
|
-
import { camelToKebab as
|
|
5
|
-
import { onTestFinished as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { toFunction as
|
|
9
|
-
async function
|
|
3
|
+
import { devOnly$getLitElementTagNameAndRuntime as x, LitElement as O } from "@arcgis/lumina";
|
|
4
|
+
import { camelToKebab as S } from "@arcgis/toolkit/string";
|
|
5
|
+
import { onTestFinished as _, beforeEach as R, afterEach as D, expect as M } from "vitest";
|
|
6
|
+
import b from "chalk";
|
|
7
|
+
import j from "js-beautify";
|
|
8
|
+
import { toFunction as z } from "@arcgis/lumina/controllers";
|
|
9
|
+
async function X(e, { parent: t = document.body, afterConnect: o, dynamicComponents: f, cleanupAfterTest: r = !0 } = {}) {
|
|
10
10
|
const n = document.createElement("div");
|
|
11
|
-
n.style.display = "contents", t.append(n),
|
|
11
|
+
n.style.display = "contents", t.append(n), r && _(() => F(n)), v(e);
|
|
12
12
|
const l = f?.some(v);
|
|
13
|
-
let
|
|
13
|
+
let i;
|
|
14
14
|
if (typeof e == "string")
|
|
15
|
-
|
|
15
|
+
i = w`<${m(e)}></${m(e)}>`;
|
|
16
16
|
else if (typeof e == "function")
|
|
17
17
|
if (p(e)) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const a = x(e).tagName;
|
|
19
|
+
i = w`<${m(a)}></${m(a)}>`;
|
|
20
20
|
} else
|
|
21
|
-
|
|
21
|
+
i = e();
|
|
22
22
|
else {
|
|
23
23
|
if (l)
|
|
24
24
|
throw new Error(
|
|
25
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'
|
|
26
26
|
);
|
|
27
|
-
|
|
27
|
+
i = e;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
function a
|
|
31
|
-
|
|
29
|
+
const s = [];
|
|
30
|
+
function c(a) {
|
|
31
|
+
s.push(a.error), a.preventDefault(), a.stopPropagation();
|
|
32
32
|
}
|
|
33
|
-
if (window.addEventListener("error",
|
|
34
|
-
throw
|
|
35
|
-
if (
|
|
36
|
-
throw new AggregateError(
|
|
33
|
+
if (window.addEventListener("error", c), C(i, n), window.removeEventListener("error", c), s.length === 1)
|
|
34
|
+
throw s[0];
|
|
35
|
+
if (s.length > 1)
|
|
36
|
+
throw new AggregateError(s, "Multiple errors occurred while creating the custom element");
|
|
37
37
|
const u = L(n), N = g, y = o?.(u);
|
|
38
38
|
y?.then !== void 0 && await y;
|
|
39
39
|
const d = u;
|
|
@@ -49,11 +49,11 @@ async function G(e, { parent: t = document.body, afterConnect: o, dynamicCompone
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
let g;
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const A = globalThis;
|
|
53
|
+
A.devOnly$luminaComponentRefCallback = (e) => {
|
|
54
54
|
g = e;
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function F(e) {
|
|
57
57
|
for (; e.firstChild; )
|
|
58
58
|
e.removeChild(e.firstChild);
|
|
59
59
|
e instanceof HTMLElement && e.remove();
|
|
@@ -61,25 +61,25 @@ function j(e) {
|
|
|
61
61
|
function v(e) {
|
|
62
62
|
if (!p(e))
|
|
63
63
|
return !1;
|
|
64
|
-
const { runtime: t, tagName: o = e.tagName } =
|
|
64
|
+
const { runtime: t, tagName: o = e.tagName } = x(e);
|
|
65
65
|
if (t !== void 0)
|
|
66
66
|
return !1;
|
|
67
|
-
let
|
|
67
|
+
let r = !1, n = o;
|
|
68
68
|
if (n === void 0) {
|
|
69
|
-
const l =
|
|
69
|
+
const l = S(
|
|
70
70
|
/*
|
|
71
71
|
* If name is a single letter, it was probably minified - thus is not
|
|
72
72
|
* stable, thus don't use it. Example: class produced by wrapController()
|
|
73
73
|
*/
|
|
74
|
-
(e.name.length > 1 ? e.name.replaceAll(
|
|
75
|
-
),
|
|
76
|
-
n =
|
|
77
|
-
for (let
|
|
78
|
-
|
|
74
|
+
(e.name.length > 1 ? e.name.replaceAll(q, "") : "") || "Test"
|
|
75
|
+
), i = l === "test" ? "te-st" : l.includes("-") ? l : `${l}-`;
|
|
76
|
+
n = i;
|
|
77
|
+
for (let s = 2, c = customElements.get(n); c !== e && c !== void 0; s += 1)
|
|
78
|
+
r = !0, n = `${i}-${s}`, c = customElements.get(n);
|
|
79
79
|
}
|
|
80
|
-
return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }),
|
|
80
|
+
return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), r;
|
|
81
81
|
}
|
|
82
|
-
const p = (e) => typeof e == "function" && "lumina" in e,
|
|
82
|
+
const p = (e) => typeof e == "function" && "lumina" in e, q = /\d+$/gu;
|
|
83
83
|
function L(e) {
|
|
84
84
|
for (const t of e.children)
|
|
85
85
|
if ("lumina" in t.constructor)
|
|
@@ -91,15 +91,43 @@ function L(e) {
|
|
|
91
91
|
}
|
|
92
92
|
return e.firstElementChild ?? g?.el;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function H() {
|
|
95
|
+
const e = $("warn"), t = $("error");
|
|
96
|
+
R(() => {
|
|
97
|
+
e.beforeEach(), t.beforeEach();
|
|
98
|
+
}), D(() => {
|
|
99
|
+
e.afterEach(), t.afterEach();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function $(e) {
|
|
103
|
+
let t = !1;
|
|
104
|
+
const o = console[e];
|
|
105
|
+
function f(...r) {
|
|
106
|
+
o(...r), t = !0;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
beforeEach() {
|
|
110
|
+
console[e] = f;
|
|
111
|
+
},
|
|
112
|
+
afterEach() {
|
|
113
|
+
if (t)
|
|
114
|
+
throw new Error(`[@arcgis/lumina:failOnConsole] Expected test not to call ${b.bold(`console.${e}()`)}.
|
|
115
|
+
If the ${e} is expected, test for it explicitly by mocking it out using:
|
|
116
|
+
${b.bold(`vi.spyOn(console, '${e}').mockImplementation(() => {}) `)}
|
|
117
|
+
and test that the ${e} occurs.`);
|
|
118
|
+
console[e] = o;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function P() {
|
|
123
|
+
M.addSnapshotSerializer({
|
|
96
124
|
// Using duck typing to detect ShadowRoot. Not using instanceof to keep test fast
|
|
97
125
|
test(e) {
|
|
98
126
|
return typeof e == "object" && e !== null && "innerHTML" in e && "onslotchange" in e;
|
|
99
127
|
},
|
|
100
128
|
serialize(e) {
|
|
101
|
-
const t = e.innerHTML.replaceAll(
|
|
102
|
-
return
|
|
129
|
+
const t = e.innerHTML.replaceAll(U, "");
|
|
130
|
+
return j.html(t, {
|
|
103
131
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
104
132
|
indent_size: 2,
|
|
105
133
|
indent_char: " ",
|
|
@@ -112,26 +140,17 @@ function A() {
|
|
|
112
140
|
}
|
|
113
141
|
});
|
|
114
142
|
}
|
|
115
|
-
const
|
|
116
|
-
function
|
|
117
|
-
|
|
118
|
-
return;
|
|
119
|
-
b[T] = !0;
|
|
120
|
-
const e = { ...console };
|
|
121
|
-
O({
|
|
122
|
-
// Workaround for https://github.com/thomasbrodusch/vitest-fail-on-console/issues/61
|
|
123
|
-
silenceMessage(t, o) {
|
|
124
|
-
return e[o](t), !1;
|
|
125
|
-
}
|
|
126
|
-
}), A();
|
|
143
|
+
const U = /<!--\??(?:lit\$\d+\$)?-->/gu;
|
|
144
|
+
function Y() {
|
|
145
|
+
T[E] || (T[E] = !0, H(), P());
|
|
127
146
|
}
|
|
128
|
-
const
|
|
129
|
-
function
|
|
130
|
-
class o extends
|
|
147
|
+
const E = Symbol.for("lumina:didSetupTest"), T = globalThis;
|
|
148
|
+
function Z(e, t) {
|
|
149
|
+
class o extends O {
|
|
131
150
|
constructor() {
|
|
132
151
|
super();
|
|
133
|
-
const
|
|
134
|
-
this.controller =
|
|
152
|
+
const r = "prototype" in e ? z(e) : e;
|
|
153
|
+
this.controller = r(this), Promise.resolve(t?.(this)).catch(console.error);
|
|
135
154
|
}
|
|
136
155
|
/*
|
|
137
156
|
* Emitting controller's exports here is useful to let controller tests
|
|
@@ -146,7 +165,7 @@ function J(e, t) {
|
|
|
146
165
|
return o;
|
|
147
166
|
}
|
|
148
167
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
X as mount,
|
|
169
|
+
Y as setupLuminaTest,
|
|
170
|
+
Z as wrapController
|
|
152
171
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/lumina-compiler",
|
|
3
|
-
"version": "4.34.0-next.
|
|
3
|
+
"version": "4.34.0-next.122",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,20 +18,19 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcgis/api-extractor": "4.34.0-next.
|
|
22
|
-
"@arcgis/components-build-utils": "4.34.0-next.
|
|
23
|
-
"@arcgis/toolkit": "4.34.0-next.
|
|
21
|
+
"@arcgis/api-extractor": "4.34.0-next.122",
|
|
22
|
+
"@arcgis/components-build-utils": "4.34.0-next.122",
|
|
23
|
+
"@arcgis/toolkit": "4.34.0-next.122",
|
|
24
24
|
"chalk": "^5.4.1",
|
|
25
25
|
"esbuild": "^0.25.5",
|
|
26
26
|
"glob": "^11.0.3",
|
|
27
27
|
"js-beautify": "^1.15.4",
|
|
28
28
|
"mime-types": "^3.0.1",
|
|
29
29
|
"tslib": "^2.8.1",
|
|
30
|
-
"vite-plugin-dts": "^4.5.4"
|
|
31
|
-
"vitest-fail-on-console": "^0.7.1"
|
|
30
|
+
"vite-plugin-dts": "^4.5.4"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
|
-
"@arcgis/lumina": "~4.34.0-next.
|
|
33
|
+
"@arcgis/lumina": "~4.34.0-next.122",
|
|
35
34
|
"lit": "^3.3.0",
|
|
36
35
|
"typescript": "~5.8.3",
|
|
37
36
|
"vite": "^7.0.0",
|