@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.
- package/dist/dependencies/loaders.d.ts +0 -4
- package/dist/dependencies/testSetupFiles.d.ts +0 -8
- package/dist/index.js +1266 -1221
- package/dist/plugins/buildCdn.d.ts +4 -0
- package/dist/testing/index.js +83 -77
- package/package.json +5 -5
|
@@ -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.
|
package/dist/testing/index.js
CHANGED
|
@@ -1,99 +1,105 @@
|
|
|
1
|
-
import { render as
|
|
2
|
-
import { unsafeStatic as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { toFunction as
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
let
|
|
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
|
-
|
|
15
|
+
r = w`<${m(e)}></${m(e)}>`;
|
|
16
16
|
else if (typeof e == "function")
|
|
17
|
-
|
|
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 (
|
|
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
|
|
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
|
-
|
|
27
|
+
r = e;
|
|
24
28
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
|
|
29
|
+
const i = [];
|
|
30
|
+
function a(c) {
|
|
31
|
+
i.push(c.error), c.preventDefault(), c.stopPropagation();
|
|
28
32
|
}
|
|
29
|
-
if (window.addEventListener("error",
|
|
30
|
-
throw
|
|
31
|
-
if (
|
|
32
|
-
throw new AggregateError(
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
typeof
|
|
37
|
-
const
|
|
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:
|
|
40
|
-
component:
|
|
43
|
+
el: u,
|
|
44
|
+
component: h,
|
|
41
45
|
async reRender() {
|
|
42
|
-
return typeof e == "function" && !(
|
|
46
|
+
return typeof e == "function" && !p(e) && C(e(), t), h.requestUpdate(), await h.updateComplete;
|
|
43
47
|
},
|
|
44
|
-
container:
|
|
48
|
+
container: n
|
|
45
49
|
};
|
|
46
50
|
}
|
|
47
|
-
let
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
let g;
|
|
52
|
+
const M = globalThis;
|
|
53
|
+
M.devOnly$luminaComponentRefCallback = (e) => {
|
|
54
|
+
g = e;
|
|
51
55
|
};
|
|
52
|
-
function
|
|
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
|
|
58
|
-
if (!
|
|
61
|
+
function v(e) {
|
|
62
|
+
if (!p(e))
|
|
59
63
|
return !1;
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
),
|
|
70
|
-
n =
|
|
71
|
-
for (let
|
|
72
|
-
|
|
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() }),
|
|
80
|
+
return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), s;
|
|
75
81
|
}
|
|
76
|
-
const
|
|
77
|
-
function
|
|
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
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
88
|
+
const o = L(t);
|
|
89
|
+
if (o != null)
|
|
90
|
+
return o;
|
|
85
91
|
}
|
|
86
|
-
return e.firstElementChild ??
|
|
92
|
+
return e.firstElementChild ?? g?.el;
|
|
87
93
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
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(
|
|
96
|
-
return
|
|
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
|
|
110
|
-
function
|
|
111
|
-
if (T
|
|
115
|
+
const F = /<!--\??(?:lit\$\d+\$)?-->/gu;
|
|
116
|
+
function I() {
|
|
117
|
+
if (b[T])
|
|
112
118
|
return;
|
|
113
|
-
T
|
|
119
|
+
b[T] = !0;
|
|
114
120
|
const e = { ...console };
|
|
115
|
-
|
|
121
|
+
O({
|
|
116
122
|
// Workaround for https://github.com/thomasbrodusch/vitest-fail-on-console/issues/61
|
|
117
|
-
silenceMessage(t,
|
|
118
|
-
return e[
|
|
123
|
+
silenceMessage(t, o) {
|
|
124
|
+
return e[o](t), !1;
|
|
119
125
|
}
|
|
120
|
-
}),
|
|
126
|
+
}), A();
|
|
121
127
|
}
|
|
122
|
-
const
|
|
123
|
-
function
|
|
124
|
-
class
|
|
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
|
|
128
|
-
this.controller =
|
|
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
|
|
146
|
+
return o;
|
|
141
147
|
}
|
|
142
148
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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.
|
|
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.
|
|
22
|
-
"@arcgis/components-build-utils": "4.33.0-next.
|
|
23
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
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.
|
|
40
|
+
"@arcgis/lumina": "~4.33.0-next.125"
|
|
41
41
|
}
|
|
42
42
|
}
|