1 |
|
2 |
|
3 |
|
4 | function _lazyRequire(e) {
|
5 | return new Proxy({}, {
|
6 | get(t, r) {
|
7 | const s = require(e);
|
8 | return Reflect.get(s, r);
|
9 | },
|
10 | set(t, r, s) {
|
11 | const n = require(e);
|
12 | return Reflect.set(n, r, s);
|
13 | }
|
14 | });
|
15 | }
|
16 |
|
17 | function _interopDefaultLegacy(e) {
|
18 | return e && "object" == typeof e && "default" in e ? e : {
|
19 | default: e
|
20 | };
|
21 | }
|
22 |
|
23 | function _interopNamespace(e) {
|
24 | if (e && e.__esModule) return e;
|
25 | var t = Object.create(null);
|
26 | return e && Object.keys(e).forEach((function(r) {
|
27 | if ("default" !== r) {
|
28 | var s = Object.getOwnPropertyDescriptor(e, r);
|
29 | Object.defineProperty(t, r, s.get ? s : {
|
30 | enumerable: !0,
|
31 | get: function() {
|
32 | return e[r];
|
33 | }
|
34 | });
|
35 | }
|
36 | })), t.default = e, Object.freeze(t);
|
37 | }
|
38 |
|
39 | async function startPuppeteerBrowser(e) {
|
40 | if (!e.flags.e2e) return null;
|
41 | const t = process.env, r = e.testing.browserExecutablePath ? "puppeteer-core" : "puppeteer", s = e.sys.lazyRequire.getModulePath(e.rootDir, r), n = e.sys.lazyRequire.require(e.rootDir, s);
|
42 | t.__STENCIL_PUPPETEER_MODULE__ = s, t.__STENCIL_BROWSER_WAIT_UNTIL = e.testing.browserWaitUntil,
|
43 | e.flags.devtools && (e.testing.browserDevtools = !0, e.testing.browserHeadless = !1,
|
44 | t.__STENCIL_E2E_DEVTOOLS__ = "true"), e.logger.debug(`puppeteer: ${s}`), e.logger.debug(`puppeteer headless: ${e.testing.browserHeadless}`),
|
45 | Array.isArray(e.testing.browserArgs) && e.logger.debug(`puppeteer args: ${e.testing.browserArgs.join(" ")}`),
|
46 | "boolean" == typeof e.testing.browserDevtools && e.logger.debug(`puppeteer devtools: ${e.testing.browserDevtools}`),
|
47 | "number" == typeof e.testing.browserSlowMo && e.logger.debug(`puppeteer slowMo: ${e.testing.browserSlowMo}`);
|
48 | const o = {
|
49 | ignoreHTTPSErrors: !0,
|
50 | slowMo: e.testing.browserSlowMo
|
51 | };
|
52 | let i;
|
53 | if (e.testing.browserWSEndpoint) i = await n.connect({
|
54 | browserWSEndpoint: e.testing.browserWSEndpoint,
|
55 | ...o
|
56 | }); else {
|
57 | const t = {
|
58 | args: e.testing.browserArgs,
|
59 | headless: e.testing.browserHeadless,
|
60 | devtools: e.testing.browserDevtools,
|
61 | ...o
|
62 | };
|
63 | e.testing.browserExecutablePath && (t.executablePath = e.testing.browserExecutablePath),
|
64 | i = await n.launch({
|
65 | ...t
|
66 | });
|
67 | }
|
68 | return t.__STENCIL_BROWSER_WS_ENDPOINT__ = i.wsEndpoint(), e.logger.debug(`puppeteer browser wsEndpoint: ${t.__STENCIL_BROWSER_WS_ENDPOINT__}`),
|
69 | i;
|
70 | }
|
71 |
|
72 | function getAppStyleUrl(e, t) {
|
73 | return e.globalStyle ? getAppUrl(e, t, `${e.fsNamespace}.css`) : null;
|
74 | }
|
75 |
|
76 | function getAppUrl(e, t, r) {
|
77 | const s = e.outputTargets.find(isOutputTargetWww);
|
78 | if (s) {
|
79 | const e = s.buildDir, n = path$2.join(e, r), o = path$2.relative(s.dir, n);
|
80 | return new URL(o, t).href;
|
81 | }
|
82 | const n = e.outputTargets.find(isOutputTargetDistLazy);
|
83 | if (n) {
|
84 | const s = n.esmDir, o = path$2.join(s, r), i = path$2.relative(e.rootDir, o);
|
85 | return new URL(i, t).href;
|
86 | }
|
87 | return t;
|
88 | }
|
89 |
|
90 | function setScreenshotEmulateData(e, t) {
|
91 | const r = {
|
92 | userAgent: "default",
|
93 | viewport: {
|
94 | width: 800,
|
95 | height: 600,
|
96 | deviceScaleFactor: 1,
|
97 | isMobile: !1,
|
98 | hasTouch: !1,
|
99 | isLandscape: !1
|
100 | }
|
101 | };
|
102 | if ("string" == typeof e.device) try {
|
103 | const s = require(t.__STENCIL_PUPPETEER_MODULE__ + "/DeviceDescriptors")[e.device];
|
104 | if (!s) return void console.error(`invalid emulate device: ${e.device}`);
|
105 | r.device = e.device, r.userAgent = s.userAgent, r.viewport = s.viewport;
|
106 | } catch (e) {
|
107 | return void console.error("error loading puppeteer DeviceDescriptors", e);
|
108 | }
|
109 | e.viewport && ("number" == typeof e.viewport.width && (r.viewport.width = e.viewport.width),
|
110 | "number" == typeof e.viewport.height && (r.viewport.height = e.viewport.height),
|
111 | "number" == typeof e.viewport.deviceScaleFactor && (r.viewport.deviceScaleFactor = e.viewport.deviceScaleFactor),
|
112 | "boolean" == typeof e.viewport.hasTouch && (r.viewport.hasTouch = e.viewport.hasTouch),
|
113 | "boolean" == typeof e.viewport.isLandscape && (r.viewport.isLandscape = e.viewport.isLandscape),
|
114 | "boolean" == typeof e.viewport.isMobile && (r.viewport.isMobile = e.viewport.isMobile),
|
115 | "string" == typeof e.userAgent && (r.userAgent = e.userAgent)), t.__STENCIL_EMULATE__ = JSON.stringify(r);
|
116 | }
|
117 |
|
118 | async function runJest(e, t) {
|
119 | let r = !1;
|
120 | try {
|
121 | const s = function s(e, t) {
|
122 | let r = e.emulate.slice();
|
123 | if ("string" == typeof t.emulate) {
|
124 | const e = t.emulate.toLowerCase();
|
125 | r = r.filter((t => "string" == typeof t.device && t.device.toLowerCase() === e || !("string" != typeof t.userAgent || !t.userAgent.toLowerCase().includes(e))));
|
126 | }
|
127 | return r;
|
128 | }(e.testing, e.flags);
|
129 | t.__STENCIL_EMULATE_CONFIGS__ = JSON.stringify(s), t.__STENCIL_ENV__ = JSON.stringify(e.env),
|
130 | e.flags.ci || e.flags.e2e ? t.__STENCIL_DEFAULT_TIMEOUT__ = "30000" : t.__STENCIL_DEFAULT_TIMEOUT__ = "15000",
|
131 | e.flags.devtools && (t.__STENCIL_DEFAULT_TIMEOUT__ = "300000000"), e.logger.debug(`default timeout: ${t.__STENCIL_DEFAULT_TIMEOUT__}`);
|
132 | const n = function n(e) {
|
133 | const t = require("yargs"), r = [ ...e.flags.unknownArgs.slice(), ...e.flags.knownArgs.slice() ];
|
134 | r.some((e => e.startsWith("--max-workers") || e.startsWith("--maxWorkers"))) || r.push(`--max-workers=${e.maxConcurrentWorkers}`),
|
135 | e.flags.devtools && r.push("--runInBand"), e.logger.info(e.logger.magenta(`jest args: ${r.join(" ")}`));
|
136 | let s = t(r).argv;
|
137 | if (s = {
|
138 | detectLeaks: !1,
|
139 | "detect-leaks": !1,
|
140 | detectOpenHandles: !1,
|
141 | "detect-open-handles": !1,
|
142 | errorOnDeprecated: !1,
|
143 | "error-on-deprecated": !1,
|
144 | listTests: !1,
|
145 | "list-tests": !1,
|
146 | maxConcurrency: 5,
|
147 | "max-concurrency": 5,
|
148 | notifyMode: "failure-change",
|
149 | "notify-mode": "failure-change",
|
150 | passWithNoTests: !1,
|
151 | "pass-with-no-tests": !1,
|
152 | runTestsByPath: !1,
|
153 | "run-tests-by-path": !1,
|
154 | testLocationInResults: !1,
|
155 | "test-location-in-results": !1,
|
156 | ...s
|
157 | }, s.config = function n(e) {
|
158 | const t = e.testing, r = require("jest-config").defaults, s = Object.keys(r), n = {};
|
159 | return Object.keys(t).forEach((e => {
|
160 | s.includes(e) && (n[e] = t[e]);
|
161 | })), n.rootDir = e.rootDir, isString(t.collectCoverage) && (n.collectCoverage = t.collectCoverage),
|
162 | Array.isArray(t.collectCoverageFrom) && (n.collectCoverageFrom = t.collectCoverageFrom),
|
163 | isString(t.coverageDirectory) && (n.coverageDirectory = t.coverageDirectory), t.coverageThreshold && (n.coverageThreshold = t.coverageThreshold),
|
164 | isString(t.globalSetup) && (n.globalSetup = t.globalSetup), isString(t.globalTeardown) && (n.globalTeardown = t.globalTeardown),
|
165 | isString(t.preset) && (n.preset = t.preset), t.projects && (n.projects = t.projects),
|
166 | Array.isArray(t.reporters) && (n.reporters = t.reporters), isString(t.testResultsProcessor) && (n.testResultsProcessor = t.testResultsProcessor),
|
167 | t.transform && (n.transform = t.transform), t.verbose && (n.verbose = t.verbose),
|
168 | n.testRunner = "jest-jasmine2", JSON.stringify(n);
|
169 | }(e), "string" == typeof s.maxWorkers) try {
|
170 | s.maxWorkers = parseInt(s.maxWorkers, 10);
|
171 | } catch (e) {}
|
172 | return "string" == typeof s.ci && (s.ci = "true" === s.ci || "" === s.ci), s;
|
173 | }(e), o = function o(e, t) {
|
174 | const r = t.projects ? t.projects : [];
|
175 | return r.push(e.rootDir), r;
|
176 | }(e, n), {runCLI: i} = require("@jest/core");
|
177 | r = !!(await i(n, o)).results.success;
|
178 | } catch (t) {
|
179 | e.logger.error(`runJest: ${t}`);
|
180 | }
|
181 | return r;
|
182 | }
|
183 |
|
184 | function createBuildId() {
|
185 | const e = new Date;
|
186 | let t = e.getFullYear() + "";
|
187 | return t += ("0" + (e.getMonth() + 1)).slice(-2), t += ("0" + e.getDate()).slice(-2),
|
188 | t += ("0" + e.getHours()).slice(-2), t += ("0" + e.getMinutes()).slice(-2), t += ("0" + e.getSeconds()).slice(-2),
|
189 | t;
|
190 | }
|
191 |
|
192 | function createBuildMessage() {
|
193 | const e = new Date;
|
194 | let t = e.getFullYear() + "-";
|
195 | return t += ("0" + (e.getMonth() + 1)).slice(-2) + "-", t += ("0" + e.getDate()).slice(-2) + " ",
|
196 | t += ("0" + e.getHours()).slice(-2) + ":", t += ("0" + e.getMinutes()).slice(-2) + ":",
|
197 | t += ("0" + e.getSeconds()).slice(-2), `Build: ${t}`;
|
198 | }
|
199 |
|
200 | function transpile(e, t = {}) {
|
201 | t = {
|
202 | ...t,
|
203 | componentExport: null,
|
204 | componentMetadata: "compilerstatic",
|
205 | coreImportPath: isString(t.coreImportPath) ? t.coreImportPath : "@stencil/core/internal/testing",
|
206 | currentDirectory: t.currentDirectory || process.cwd(),
|
207 | module: "cjs",
|
208 | proxy: null,
|
209 | sourceMap: "inline",
|
210 | style: null,
|
211 | styleImportData: "queryparams",
|
212 | target: "es2015"
|
213 | };
|
214 | try {
|
215 | const e = process.versions.node.split(".");
|
216 | parseInt(e[0], 10) >= 10 && (t.target = "es2017");
|
217 | } catch (e) {}
|
218 | return stencil_js.transpileSync(e, t);
|
219 | }
|
220 |
|
221 | function formatDiagnostic(e) {
|
222 | let t = "";
|
223 | return e.relFilePath && (t += e.relFilePath, "number" == typeof e.lineNumber && (t += ":" + e.lineNumber + 1,
|
224 | "number" == typeof e.columnNumber && (t += ":" + e.columnNumber)), t += "\n"), t += e.messageText,
|
225 | t;
|
226 | }
|
227 |
|
228 | function getCompilerOptions(e) {
|
229 | if (_tsCompilerOptions) return _tsCompilerOptions;
|
230 | if ("string" != typeof e) return null;
|
231 | e = normalizePath(e);
|
232 | const t = stencil_js.ts.findConfigFile(e, stencil_js.ts.sys.fileExists);
|
233 | if (!t) return null;
|
234 | const r = stencil_js.ts.readConfigFile(t, stencil_js.ts.sys.readFile);
|
235 | if (r.error) throw new Error(formatDiagnostic((e => {
|
236 | const t = {
|
237 | level: "warn",
|
238 | type: "typescript",
|
239 | language: "typescript",
|
240 | header: "TypeScript",
|
241 | code: e.code.toString(),
|
242 | messageText: flattenDiagnosticMessageText(e, e.messageText),
|
243 | relFilePath: null,
|
244 | absFilePath: null,
|
245 | lines: []
|
246 | };
|
247 | if (1 === e.category && (t.level = "error"), e.file) {
|
248 | t.absFilePath = e.file.fileName;
|
249 | const s = "string" != typeof (r = e.file.text) ? [] : (r = r.replace(/\\r/g, "\n")).split("\n"), n = e.file.getLineAndCharacterOfPosition(e.start), o = {
|
250 | lineIndex: n.line,
|
251 | lineNumber: n.line + 1,
|
252 | text: s[n.line],
|
253 | errorCharStart: n.character,
|
254 | errorLength: Math.max(e.length, 1)
|
255 | };
|
256 | if (t.lineNumber = o.lineNumber, t.columnNumber = o.errorCharStart + 1, t.lines.push(o),
|
257 | 0 === o.errorLength && o.errorCharStart > 0 && (o.errorLength = 1, o.errorCharStart--),
|
258 | o.lineIndex > 0) {
|
259 | const e = {
|
260 | lineIndex: o.lineIndex - 1,
|
261 | lineNumber: o.lineNumber - 1,
|
262 | text: s[o.lineIndex - 1],
|
263 | errorCharStart: -1,
|
264 | errorLength: -1
|
265 | };
|
266 | t.lines.unshift(e);
|
267 | }
|
268 | if (o.lineIndex + 1 < s.length) {
|
269 | const e = {
|
270 | lineIndex: o.lineIndex + 1,
|
271 | lineNumber: o.lineNumber + 1,
|
272 | text: s[o.lineIndex + 1],
|
273 | errorCharStart: -1,
|
274 | errorLength: -1
|
275 | };
|
276 | t.lines.push(e);
|
277 | }
|
278 | }
|
279 | var r;
|
280 | return t;
|
281 | })(r.error)));
|
282 | const s = stencil_js.ts.parseJsonConfigFileContent(r.config, stencil_js.ts.sys, e, void 0, t);
|
283 | return _tsCompilerOptions = s.options, _tsCompilerOptions;
|
284 | }
|
285 |
|
286 | function compareHtml(e, t, r) {
|
287 | if (null == e) throw new Error(`expect toEqualHtml() value is "${e}"`);
|
288 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
289 | let s;
|
290 | if (1 === e.nodeType) {
|
291 | const t = function n(e) {
|
292 | return e && e.ownerDocument && e.ownerDocument.defaultView && e.ownerDocument.defaultView.__stencil_spec_options || {};
|
293 | }(e);
|
294 | s = index_cjs.serializeNodeToHtml(e, {
|
295 | prettyHtml: !0,
|
296 | outerHtml: !0,
|
297 | removeHtmlComments: !1 === t.includeAnnotations,
|
298 | excludeTags: [ "body" ],
|
299 | serializeShadowRoot: r
|
300 | });
|
301 | } else if (11 === e.nodeType) s = index_cjs.serializeNodeToHtml(e, {
|
302 | prettyHtml: !0,
|
303 | excludeTags: [ "style" ],
|
304 | excludeTagContent: [ "style" ],
|
305 | serializeShadowRoot: r
|
306 | }); else {
|
307 | if ("string" != typeof e) throw new Error("expect toEqualHtml() value should be an element, shadow root or string.");
|
308 | {
|
309 | const t = index_cjs.parseHtmlToFragment(e);
|
310 | s = index_cjs.serializeNodeToHtml(t, {
|
311 | prettyHtml: !0,
|
312 | serializeShadowRoot: r
|
313 | });
|
314 | }
|
315 | }
|
316 | const o = index_cjs.parseHtmlToFragment(t), i = index_cjs.serializeNodeToHtml(o, {
|
317 | prettyHtml: !0,
|
318 | excludeTags: [ "body" ]
|
319 | });
|
320 | return s !== i ? (expect(s).toBe(i), {
|
321 | message: () => "HTML does not match",
|
322 | pass: !1
|
323 | }) : {
|
324 | message: () => "expect HTML to match",
|
325 | pass: !0
|
326 | };
|
327 | }
|
328 |
|
329 | function toHaveClasses(e, t) {
|
330 | if (!e) throw new Error("expect toHaveClasses value is null");
|
331 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
332 | if (1 !== e.nodeType) throw new Error("expect toHaveClasses value is not an element");
|
333 | const r = t.every((t => e.classList.contains(t)));
|
334 | return {
|
335 | message: () => `expected to ${r ? "not " : ""}have css classes "${t.join(" ")}", but className is "${e.className}"`,
|
336 | pass: r
|
337 | };
|
338 | }
|
339 |
|
340 | async function globalMockFetch(e) {
|
341 | let t;
|
342 | if (null == e) throw new Error("missing url input for mock fetch()");
|
343 | if ("string" == typeof e) t = e; else {
|
344 | if ("string" != typeof e.url) throw new Error("invalid url for mock fetch()");
|
345 | t = e.url;
|
346 | }
|
347 | t = new URL(t, location.href).href;
|
348 | let r = mockedResponses.get(t);
|
349 | if (null == r) {
|
350 | const e = new URL(FETCH_DEFAULT_PATH, location.href);
|
351 | r = mockedResponses.get(e.href);
|
352 | }
|
353 | if (null == r) return new MockResponse404;
|
354 | const s = r.response.clone();
|
355 | return "number" != typeof s.status && (s.status = 200), "string" != typeof s.statusText && (s.status >= 500 ? s.statusText = "Internal Server Error" : 404 === s.status ? s.statusText = "Not Found" : s.status >= 400 ? s.statusText = "Bad Request" : 302 === s.status ? s.statusText = "Found" : 301 === s.status ? s.statusText = "Moved Permanently" : s.status >= 300 ? s.statusText = "Redirection" : s.statusText = "OK"),
|
356 | s.ok = s.status >= 200 && s.status <= 299, "string" != typeof s.type && (s.type = "basic"),
|
357 | s;
|
358 | }
|
359 |
|
360 | function setMockedResponse(e, t, r) {
|
361 | if (!e) throw new Error("MockResponse required");
|
362 | "string" == typeof e.url && "" !== e.url || ("string" == typeof t ? e.url = t : t && "string" == typeof t.url ? e.url = t.url : e.url = FETCH_DEFAULT_PATH);
|
363 | const s = new URL(e.url, location.href);
|
364 | e.url = s.href;
|
365 | const n = {
|
366 | response: e,
|
367 | reject: r
|
368 | };
|
369 | mockedResponses.set(e.url, n);
|
370 | }
|
371 |
|
372 | function resetBuildConditionals(e) {
|
373 | Object.keys(e).forEach((t => {
|
374 | e[t] = !0;
|
375 | })), e.isDev = !0, e.isTesting = !0, e.isDebug = !1, e.lazyLoad = !0, e.member = !0,
|
376 | e.reflect = !0, e.scoped = !0, e.shadowDom = !0, e.slotRelocation = !0, e.asyncLoading = !0,
|
377 | e.svg = !0, e.updatable = !0, e.vdomAttribute = !0, e.vdomClass = !0, e.vdomFunctional = !0,
|
378 | e.vdomKey = !0, e.vdomPropOrAttr = !0, e.vdomRef = !0, e.vdomListener = !0, e.vdomStyle = !0,
|
379 | e.vdomText = !0, e.vdomXlink = !0, e.allRenderFn = !1, e.devTools = !1, e.hydrateClientSide = !1,
|
380 | e.hydrateServerSide = !1, e.cssAnnotations = !1, e.style = !1, e.hydratedAttribute = !1,
|
381 | e.hydratedClass = !0, e.invisiblePrehydration = !0, e.appendChildSlotFix = !1, e.cloneNodeFix = !1,
|
382 | e.dynamicImportShim = !1, e.hotModuleReplacement = !1, e.safari10 = !1, e.scriptDataOpts = !1,
|
383 | e.scopedSlotTextContentFix = !1, e.slotChildNodesFix = !1;
|
384 | }
|
385 |
|
386 | function assertPath(e) {
|
387 | if ("string" != typeof e) throw new TypeError("Path must be a string. Received " + JSON.stringify(e));
|
388 | }
|
389 |
|
390 | function normalizeStringPosix(e, t) {
|
391 | var r, s, n, o = "", i = 0, a = -1, l = 0;
|
392 | for (s = 0; s <= e.length; ++s) {
|
393 | if (s < e.length) r = e.charCodeAt(s); else {
|
394 | if (47 === r) break;
|
395 | r = 47;
|
396 | }
|
397 | if (47 === r) {
|
398 | if (a === s - 1 || 1 === l) ; else if (a !== s - 1 && 2 === l) {
|
399 | if (o.length < 2 || 2 !== i || 46 !== o.charCodeAt(o.length - 1) || 46 !== o.charCodeAt(o.length - 2)) if (o.length > 2) {
|
400 | if ((n = o.lastIndexOf("/")) !== o.length - 1) {
|
401 | -1 === n ? (o = "", i = 0) : i = (o = o.slice(0, n)).length - 1 - o.lastIndexOf("/"),
|
402 | a = s, l = 0;
|
403 | continue;
|
404 | }
|
405 | } else if (2 === o.length || 1 === o.length) {
|
406 | o = "", i = 0, a = s, l = 0;
|
407 | continue;
|
408 | }
|
409 | t && (o.length > 0 ? o += "/.." : o = "..", i = 2);
|
410 | } else o.length > 0 ? o += "/" + e.slice(a + 1, s) : o = e.slice(a + 1, s), i = s - a - 1;
|
411 | a = s, l = 0;
|
412 | } else 46 === r && -1 !== l ? ++l : l = -1;
|
413 | }
|
414 | return o;
|
415 | }
|
416 |
|
417 | function specifierIncluded$1(e, t) {
|
418 | var r, s, n, o = e.split("."), i = t.split(" "), a = i.length > 1 ? i[0] : "=", l = (i.length > 1 ? i[1] : i[0]).split(".");
|
419 | for (r = 0; r < 3; ++r) if ((s = parseInt(o[r] || 0, 10)) !== (n = parseInt(l[r] || 0, 10))) return "<" === a ? s < n : ">=" === a && s >= n;
|
420 | return ">=" === a;
|
421 | }
|
422 |
|
423 | function matchesRange$1(e, t) {
|
424 | var r, s = t.split(/ ?&& ?/);
|
425 | if (0 === s.length) return !1;
|
426 | for (r = 0; r < s.length; ++r) if (!specifierIncluded$1(e, s[r])) return !1;
|
427 | return !0;
|
428 | }
|
429 |
|
430 | function specifierIncluded(e) {
|
431 | var t, r, s, n = e.split(" "), o = n.length > 1 ? n[0] : "=", i = (n.length > 1 ? n[1] : n[0]).split(".");
|
432 | for (t = 0; t < 3; ++t) if ((r = parseInt(current[t] || 0, 10)) !== (s = parseInt(i[t] || 0, 10))) return "<" === o ? r < s : ">=" === o && r >= s;
|
433 | return ">=" === o;
|
434 | }
|
435 |
|
436 | function matchesRange(e) {
|
437 | var t, r = e.split(/ ?&& ?/);
|
438 | if (0 === r.length) return !1;
|
439 | for (t = 0; t < r.length; ++t) if (!specifierIncluded(r[t])) return !1;
|
440 | return !0;
|
441 | }
|
442 |
|
443 | function versionIncluded(e) {
|
444 | if ("boolean" == typeof e) return e;
|
445 | if (e && "object" == typeof e) {
|
446 | for (var t = 0; t < e.length; ++t) if (matchesRange(e[t])) return !0;
|
447 | return !1;
|
448 | }
|
449 | return matchesRange(e);
|
450 | }
|
451 |
|
452 | function mockConfig(e = {}) {
|
453 | const t = path__default.default.resolve("/");
|
454 | let {sys: r} = e;
|
455 | return r || (r = createTestingSystem()), r.getCurrentDirectory = () => t, {
|
456 | _isTesting: !0,
|
457 | buildAppCore: !1,
|
458 | buildDist: !0,
|
459 | buildEs5: !1,
|
460 | bundles: null,
|
461 | devMode: !0,
|
462 | enableCache: !1,
|
463 | extras: {},
|
464 | flags: createConfigFlags(),
|
465 | globalScript: null,
|
466 | hashFileNames: !1,
|
467 | logger: new TestingLogger,
|
468 | maxConcurrentWorkers: 0,
|
469 | minifyCss: !1,
|
470 | minifyJs: !1,
|
471 | namespace: "Testing",
|
472 | nodeResolve: {
|
473 | customResolveOptions: {}
|
474 | },
|
475 | outputTargets: null,
|
476 | rollupPlugins: {
|
477 | before: [],
|
478 | after: []
|
479 | },
|
480 | rootDir: t,
|
481 | sourceMap: !0,
|
482 | sys: r,
|
483 | testing: null,
|
484 | validateTypes: !1,
|
485 | ...e
|
486 | };
|
487 | }
|
488 |
|
489 | function mockCompilerCtx(e) {
|
490 | e || (e = mockConfig());
|
491 | const t = {
|
492 | version: 1,
|
493 | activeBuildId: 0,
|
494 | activeDirsAdded: [],
|
495 | activeDirsDeleted: [],
|
496 | activeFilesAdded: [],
|
497 | activeFilesDeleted: [],
|
498 | activeFilesUpdated: [],
|
499 | addWatchDir: noop,
|
500 | addWatchFile: noop,
|
501 | cachedGlobalStyle: null,
|
502 | changedFiles: new Set,
|
503 | changedModules: new Set,
|
504 | collections: [],
|
505 | compilerOptions: null,
|
506 | cache: null,
|
507 | cssModuleImports: new Map,
|
508 | events: buildEvents(),
|
509 | fs: null,
|
510 | hasSuccessfulBuild: !1,
|
511 | isActivelyBuilding: !1,
|
512 | lastBuildResults: null,
|
513 | moduleMap: new Map,
|
514 | nodeMap: new WeakMap,
|
515 | reset: noop,
|
516 | resolvedCollections: new Set,
|
517 | rollupCache: new Map,
|
518 | rollupCacheHydrate: null,
|
519 | rollupCacheLazy: null,
|
520 | rollupCacheNative: null,
|
521 | styleModeNames: new Set,
|
522 | worker: stencil_js.createWorkerContext(e.sys)
|
523 | };
|
524 | return Object.defineProperty(t, "fs", {
|
525 | get() {
|
526 | return null == this._fs && (this._fs = (e => {
|
527 | const t = new Map, r = new Map, s = async (e, r = {}) => {
|
528 | e = normalizePath(e);
|
529 | const s = [];
|
530 | if (!0 === r.inMemoryOnly) {
|
531 | let n = e;
|
532 | n.endsWith("/") || (n += "/");
|
533 | const i = e.split("/");
|
534 | t.forEach(((t, n) => {
|
535 | if (!n.startsWith(e)) return;
|
536 | const a = n.split("/");
|
537 | if ((a.length === i.length + 1 || r.recursive && a.length > i.length) && t.exists) {
|
538 | const e = {
|
539 | absPath: n,
|
540 | relPath: a[i.length],
|
541 | isDirectory: t.isDirectory,
|
542 | isFile: t.isFile
|
543 | };
|
544 | o(r, e) || s.push(e);
|
545 | }
|
546 | }));
|
547 | } else await n(e, e, r, s);
|
548 | return s.sort(((e, t) => e.absPath < t.absPath ? -1 : e.absPath > t.absPath ? 1 : 0));
|
549 | }, n = async (t, r, s, i) => {
|
550 | const a = await e.readDir(r);
|
551 | if (a.length > 0) {
|
552 | const e = v(r);
|
553 | e.exists = !0, e.isFile = !1, e.isDirectory = !0, await Promise.all(a.map((async e => {
|
554 | const r = normalizePath(e), a = normalizePath(path$2.relative(t, r)), c = await l(r), u = {
|
555 | absPath: r,
|
556 | relPath: a,
|
557 | isDirectory: c.isDirectory,
|
558 | isFile: c.isFile
|
559 | };
|
560 | o(s, u) || (i.push(u), !0 === s.recursive && !0 === c.isDirectory && await n(t, r, s, i));
|
561 | })));
|
562 | }
|
563 | }, o = (e, t) => {
|
564 | if (t.isDirectory) {
|
565 | if (Array.isArray(e.excludeDirNames)) {
|
566 | const r = path$2.basename(t.absPath);
|
567 | if (e.excludeDirNames.some((e => r === e))) return !0;
|
568 | }
|
569 | } else if (Array.isArray(e.excludeExtensions)) {
|
570 | const r = t.relPath.toLowerCase();
|
571 | if (e.excludeExtensions.some((e => r.endsWith(e)))) return !0;
|
572 | }
|
573 | return !1;
|
574 | }, i = async e => {
|
575 | const t = v(e);
|
576 | t.isFile = !1, t.isDirectory = !0, t.queueWriteToDisk || (t.queueDeleteFromDisk = !0);
|
577 | try {
|
578 | const t = await s(e, {
|
579 | recursive: !0
|
580 | });
|
581 | await Promise.all(t.map((e => e.relPath.endsWith(".gitkeep") ? null : a(e.absPath))));
|
582 | } catch (e) {}
|
583 | }, a = async e => {
|
584 | const t = v(e);
|
585 | t.queueWriteToDisk || (t.queueDeleteFromDisk = !0);
|
586 | }, l = async t => {
|
587 | const r = v(t);
|
588 | if ("boolean" != typeof r.isDirectory || "boolean" != typeof r.isFile) {
|
589 | const s = await e.stat(t);
|
590 | s.error ? r.exists = !1 : (r.exists = !0, s.isFile ? (r.isFile = !0, r.isDirectory = !1,
|
591 | r.size = s.size) : s.isDirectory ? (r.isFile = !1, r.isDirectory = !0, r.size = s.size) : (r.isFile = !1,
|
592 | r.isDirectory = !1, r.size = null));
|
593 | }
|
594 | return {
|
595 | exists: !!r.exists,
|
596 | isFile: !!r.isFile,
|
597 | isDirectory: !!r.isDirectory,
|
598 | size: "number" == typeof r.size ? r.size : 0
|
599 | };
|
600 | }, c = t => {
|
601 | const r = v(t);
|
602 | if ("boolean" != typeof r.isDirectory || "boolean" != typeof r.isFile) {
|
603 | const s = e.statSync(t);
|
604 | s.error ? r.exists = !1 : (r.exists = !0, s.isFile ? (r.isFile = !0, r.isDirectory = !1,
|
605 | r.size = s.size) : s.isDirectory ? (r.isFile = !1, r.isDirectory = !0, r.size = s.size) : (r.isFile = !1,
|
606 | r.isDirectory = !1, r.size = null));
|
607 | }
|
608 | return {
|
609 | exists: !!r.exists,
|
610 | isFile: !!r.isFile,
|
611 | isDirectory: !!r.isDirectory,
|
612 | size: r.size
|
613 | };
|
614 | }, u = async (t, s, n) => {
|
615 | if ("string" != typeof t) throw new Error(`writeFile, invalid filePath: ${t}`);
|
616 | if ("string" != typeof s) throw new Error(`writeFile, invalid content: ${t}`);
|
617 | const o = {
|
618 | ignored: !1,
|
619 | changedContent: !1,
|
620 | queuedWrite: !1
|
621 | };
|
622 | if (!0 === shouldIgnore(t)) return o.ignored = !0, o;
|
623 | const i = v(t);
|
624 | if (i.exists = !0, i.isFile = !0, i.isDirectory = !1, i.queueDeleteFromDisk = !1,
|
625 | "string" == typeof i.fileText ? o.changedContent = i.fileText.replace(/\r/g, "") !== s.replace(/\r/g, "") : o.changedContent = !0,
|
626 | i.fileText = s, o.queuedWrite = !1, null != n && ("string" == typeof n.outputTargetType && r.set(t, n.outputTargetType),
|
627 | !1 === n.useCache && (i.useCache = !1)), null != n && !0 === n.inMemoryOnly) i.queueWriteToDisk ? o.queuedWrite = !0 : i.queueWriteToDisk = !1,
|
628 | await d(t, !0); else if (null != n && !0 === n.immediateWrite) {
|
629 | if (o.changedContent || !0 !== n.useCache) {
|
630 | const r = await e.readFile(t);
|
631 | "string" == typeof r && (o.changedContent = i.fileText.replace(/\r/g, "") !== r.replace(/\r/g, "")),
|
632 | o.changedContent && (await d(t, !1), await e.writeFile(t, i.fileText));
|
633 | }
|
634 | } else i.queueWriteToDisk || !0 !== o.changedContent || (i.queueWriteToDisk = !0,
|
635 | o.queuedWrite = !0);
|
636 | return o;
|
637 | }, d = async (e, t) => {
|
638 | const r = [];
|
639 | for (;"string" == typeof (e = path$2.dirname(e)) && e.length > 0 && "/" !== e && !1 === e.endsWith(":/") && !1 === e.endsWith(":\\"); ) r.push(e);
|
640 | r.reverse(), await h(r, t);
|
641 | }, h = async (t, r) => {
|
642 | const s = [];
|
643 | for (const n of t) {
|
644 | const t = v(n);
|
645 | if (!0 !== t.exists || !0 !== t.isDirectory) try {
|
646 | t.exists = !0, t.isDirectory = !0, t.isFile = !1, r || await e.createDir(n), s.push(n);
|
647 | } catch (e) {}
|
648 | }
|
649 | return s;
|
650 | }, p = t => Promise.all(t.map((async t => {
|
651 | const [r, s] = t;
|
652 | return await e.copyFile(r, s), [ r, s ];
|
653 | }))), f = e => Promise.all(e.map((async e => {
|
654 | if ("string" != typeof e) throw new Error("unable to writeFile without filePath");
|
655 | return m(e);
|
656 | }))), m = async t => {
|
657 | const r = v(t);
|
658 | if (null == r.fileText) throw new Error(`unable to find item fileText to write: ${t}`);
|
659 | return await e.writeFile(t, r.fileText), !1 === r.useCache && _(t), t;
|
660 | }, g = async t => await Promise.all(t.map((async t => {
|
661 | if ("string" != typeof t) throw new Error("unable to unlink without filePath");
|
662 | return await e.removeFile(t), t;
|
663 | }))), y = async t => {
|
664 | const r = [];
|
665 | for (const s of t) await e.removeDir(s), r.push(s);
|
666 | return r;
|
667 | }, w = e => {
|
668 | e = normalizePath(e), t.forEach(((t, r) => {
|
669 | const s = path$2.relative(e, r).split("/")[0];
|
670 | s.startsWith(".") || s.startsWith("/") || _(r);
|
671 | }));
|
672 | }, _ = e => {
|
673 | e = normalizePath(e);
|
674 | const r = t.get(e);
|
675 | null == r || r.queueWriteToDisk || t.delete(e);
|
676 | }, v = e => {
|
677 | e = normalizePath(e);
|
678 | let r = t.get(e);
|
679 | return null != r || t.set(e, r = {
|
680 | exists: null,
|
681 | fileText: null,
|
682 | size: null,
|
683 | mtimeMs: null,
|
684 | isDirectory: null,
|
685 | isFile: null,
|
686 | queueCopyFileToDest: null,
|
687 | queueDeleteFromDisk: null,
|
688 | queueWriteToDisk: null,
|
689 | useCache: null
|
690 | }), r;
|
691 | }, b = 5242880;
|
692 | return {
|
693 | access: async e => {
|
694 | const t = v(e);
|
695 | return "boolean" != typeof t.exists ? (await l(e)).exists : t.exists;
|
696 | },
|
697 | accessSync: e => {
|
698 | const t = v(e);
|
699 | return "boolean" != typeof t.exists ? c(e).exists : t.exists;
|
700 | },
|
701 | cancelDeleteDirectoriesFromDisk: e => {
|
702 | for (const t of e) {
|
703 | const e = v(t);
|
704 | !0 === e.queueDeleteFromDisk && (e.queueDeleteFromDisk = !1);
|
705 | }
|
706 | },
|
707 | cancelDeleteFilesFromDisk: e => {
|
708 | for (const t of e) {
|
709 | const e = v(t);
|
710 | !0 === e.isFile && !0 === e.queueDeleteFromDisk && (e.queueDeleteFromDisk = !1);
|
711 | }
|
712 | },
|
713 | clearCache: () => {
|
714 | t.clear();
|
715 | },
|
716 | clearDirCache: w,
|
717 | clearFileCache: _,
|
718 | commit: async () => {
|
719 | const e = getCommitInstructions(t), r = await h(e.dirsToEnsure, !1), s = await f(e.filesToWrite), n = await p(e.filesToCopy), o = await g(e.filesToDelete), i = await y(e.dirsToDelete);
|
720 | return e.filesToDelete.forEach(_), e.dirsToDelete.forEach(w), {
|
721 | filesCopied: n,
|
722 | filesWritten: s,
|
723 | filesDeleted: o,
|
724 | dirsDeleted: i,
|
725 | dirsAdded: r
|
726 | };
|
727 | },
|
728 | copyFile: async (e, t) => {
|
729 | v(e).queueCopyFileToDest = t;
|
730 | },
|
731 | emptyDirs: async e => {
|
732 | e = e.filter(isString).map(normalizePath).reduce(((e, t) => (e.includes(t) || e.push(t),
|
733 | e)), []);
|
734 | const t = await Promise.all(e.map((e => s(e, {
|
735 | recursive: !0
|
736 | })))), r = [];
|
737 | for (const e of t) for (const t of e) r.includes(t.absPath) || r.push(t.absPath);
|
738 | r.sort(((e, t) => {
|
739 | const r = e.split("/").length, s = t.split("/").length;
|
740 | return r < s ? 1 : r > s ? -1 : 0;
|
741 | })), await Promise.all(r.map(a)), e.forEach((e => {
|
742 | const t = v(e);
|
743 | t.isFile = !1, t.isDirectory = !0, t.queueWriteToDisk = !0, t.queueDeleteFromDisk = !1;
|
744 | }));
|
745 | },
|
746 | getBuildOutputs: () => {
|
747 | const e = [];
|
748 | return r.forEach(((t, r) => {
|
749 | const s = e.find((e => e.type === t));
|
750 | s ? s.files.push(r) : e.push({
|
751 | type: t,
|
752 | files: [ r ]
|
753 | });
|
754 | })), e.forEach((e => e.files.sort())), e.sort(((e, t) => e.type < t.type ? -1 : e.type > t.type ? 1 : 0));
|
755 | },
|
756 | getItem: v,
|
757 | getMemoryStats: () => `data length: ${t.size}`,
|
758 | readFile: async (t, r) => {
|
759 | if (null == r || !0 === r.useCache || void 0 === r.useCache) {
|
760 | const e = v(t);
|
761 | if (e.exists && "string" == typeof e.fileText) return e.fileText;
|
762 | }
|
763 | const s = await e.readFile(t), n = v(t);
|
764 | return "string" == typeof s ? s.length < b && (n.exists = !0, n.isFile = !0, n.isDirectory = !1,
|
765 | n.fileText = s) : n.exists = !1, s;
|
766 | },
|
767 | readFileSync: (t, r) => {
|
768 | if (null == r || !0 === r.useCache || void 0 === r.useCache) {
|
769 | const e = v(t);
|
770 | if (e.exists && "string" == typeof e.fileText) return e.fileText;
|
771 | }
|
772 | const s = e.readFileSync(t), n = v(t);
|
773 | return "string" == typeof s ? s.length < b && (n.exists = !0, n.isFile = !0, n.isDirectory = !1,
|
774 | n.fileText = s) : n.exists = !1, s;
|
775 | },
|
776 | readdir: s,
|
777 | remove: async e => {
|
778 | const t = await l(e);
|
779 | !0 === t.isDirectory ? await i(e) : !0 === t.isFile && await a(e);
|
780 | },
|
781 | stat: l,
|
782 | statSync: c,
|
783 | sys: e,
|
784 | writeFile: u,
|
785 | writeFiles: (e, t) => {
|
786 | const r = [];
|
787 | return isIterable(e) ? e.forEach(((e, s) => {
|
788 | r.push(u(s, e, t));
|
789 | })) : Object.keys(e).map((s => {
|
790 | r.push(u(s, e[s], t));
|
791 | })), Promise.all(r);
|
792 | }
|
793 | };
|
794 | })(e.sys)), this._fs;
|
795 | }
|
796 | }), Object.defineProperty(t, "cache", {
|
797 | get() {
|
798 | return null == this._cache && (this._cache = function r(e, t) {
|
799 | e || (e = mockConfig()), t || (t = mockCompilerCtx(e)), e.enableCache = !0;
|
800 | const r = new Cache(e, t.fs);
|
801 | return r.initCacheDir(), r;
|
802 | }(e, t)), this._cache;
|
803 | }
|
804 | }), t;
|
805 | }
|
806 |
|
807 | function mockLogger() {
|
808 | return new TestingLogger;
|
809 | }
|
810 |
|
811 | function findRootComponent(e, t) {
|
812 | if (null != t) {
|
813 | const r = t.children, s = r.length;
|
814 | for (let t = 0; t < s; t++) {
|
815 | const s = r[t];
|
816 | if (e.has(s.nodeName.toLowerCase())) return s;
|
817 | }
|
818 | for (let t = 0; t < s; t++) {
|
819 | const s = findRootComponent(e, r[t]);
|
820 | if (null != s) return s;
|
821 | }
|
822 | }
|
823 | return null;
|
824 | }
|
825 |
|
826 | async function initPageEvents(e) {
|
827 | e._e2eEvents = new Map, e._e2eEventIds = 0, e.spyOnEvent = pageSpyOnEvent.bind(e, e),
|
828 | await e.exposeFunction("stencilOnEvent", ((t, r) => {
|
829 | !function s(e, t, r) {
|
830 | const s = e.get(t);
|
831 | s && s.callback(r);
|
832 | }(e._e2eEvents, t, r);
|
833 | })), await e.evaluateOnNewDocument(browserContextEvents);
|
834 | }
|
835 |
|
836 | async function pageSpyOnEvent(e, t, r) {
|
837 | const s = new EventSpy(t), n = "document" !== r ? () => window : () => document, o = await e.evaluateHandle(n);
|
838 | return await addE2EListener(e, o, t, (e => {
|
839 | s.push(e);
|
840 | })), s;
|
841 | }
|
842 |
|
843 | async function waitForEvent(e, t, r) {
|
844 | const s = .5 * jasmine.DEFAULT_TIMEOUT_INTERVAL, n = await e.evaluate(((e, t, r) => new Promise(((s, n) => {
|
845 | const o = setTimeout((() => {
|
846 | n(new Error(`waitForEvent() timeout, eventName: ${t}`));
|
847 | }), r);
|
848 | e.addEventListener(t, (e => {
|
849 | clearTimeout(o), s(window.stencilSerializeEvent(e));
|
850 | }), {
|
851 | once: !0
|
852 | });
|
853 | }))), r, t, s);
|
854 | return await e.waitForChanges(), n;
|
855 | }
|
856 |
|
857 | async function addE2EListener(e, t, r, s) {
|
858 | const n = e._e2eEventIds++;
|
859 | e._e2eEvents.set(n, {
|
860 | eventName: r,
|
861 | callback: s
|
862 | });
|
863 | const o = t.executionContext();
|
864 | await o.evaluate(((e, t, r) => {
|
865 | e.addEventListener(r, (e => {
|
866 | window.stencilOnEvent(t, window.stencilSerializeEvent(e));
|
867 | }));
|
868 | }), t, n, r);
|
869 | }
|
870 |
|
871 | function browserContextEvents() {
|
872 | const e = () => {
|
873 | const e = [], t = (e, r) => {
|
874 | if (null != r && 1 === r.nodeType) for (let s = 0; s < r.children.length; s++) {
|
875 | const n = r.children[s];
|
876 | n.tagName.includes("-") && "function" == typeof n.componentOnReady && e.push(n.componentOnReady()),
|
877 | t(e, n);
|
878 | }
|
879 | };
|
880 | return t(e, window.document.documentElement), Promise.all(e).catch((e => console.error(e)));
|
881 | }, t = () => e().then((() => new Promise((e => {
|
882 | requestAnimationFrame(e);
|
883 | })))).then((() => e())).then((() => {
|
884 | window.stencilAppLoaded = !0;
|
885 | }));
|
886 | window.stencilSerializeEventTarget = e => e ? e === window ? {
|
887 | serializedWindow: !0
|
888 | } : e === document ? {
|
889 | serializedDocument: !0
|
890 | } : null != e.nodeType ? {
|
891 | serializedElement: !0,
|
892 | nodeName: e.nodeName,
|
893 | nodeValue: e.nodeValue,
|
894 | nodeType: e.nodeType,
|
895 | tagName: e.tagName,
|
896 | className: e.className,
|
897 | id: e.id
|
898 | } : null : null, window.stencilSerializeEvent = e => ({
|
899 | bubbles: e.bubbles,
|
900 | cancelBubble: e.cancelBubble,
|
901 | cancelable: e.cancelable,
|
902 | composed: e.composed,
|
903 | currentTarget: window.stencilSerializeEventTarget(e.currentTarget),
|
904 | defaultPrevented: e.defaultPrevented,
|
905 | detail: e.detail,
|
906 | eventPhase: e.eventPhase,
|
907 | isTrusted: e.isTrusted,
|
908 | returnValue: e.returnValue,
|
909 | srcElement: window.stencilSerializeEventTarget(e.srcElement),
|
910 | target: window.stencilSerializeEventTarget(e.target),
|
911 | timeStamp: e.timeStamp,
|
912 | type: e.type,
|
913 | isSerializedEvent: !0
|
914 | }), "complete" === window.document.readyState ? t() : document.addEventListener("readystatechange", (function(e) {
|
915 | "complete" == e.target.readyState && t();
|
916 | }));
|
917 | }
|
918 |
|
919 | async function find(e, t, r) {
|
920 | const {lightSelector: s, shadowSelector: n, text: o, contains: i} = getSelector(r);
|
921 | let a;
|
922 | if (a = "string" == typeof s ? await async function l(e, t, r, s) {
|
923 | let n = await t.$(r);
|
924 | if (!n) return null;
|
925 | if (s) {
|
926 | const t = await e.evaluateHandle(((e, t) => {
|
927 | if (!e.shadowRoot) throw new Error(`shadow root does not exist for element: ${e.tagName.toLowerCase()}`);
|
928 | return e.shadowRoot.querySelector(t);
|
929 | }), n, s);
|
930 | if (await n.dispose(), !t) return null;
|
931 | n = t.asElement();
|
932 | }
|
933 | return n;
|
934 | }(e, t, s, n) : await async function c(e, t, r, s) {
|
935 | const n = await e.evaluateHandle(((e, t, r) => {
|
936 | let s = null;
|
937 | return function e(n) {
|
938 | if (n && !s) if (3 === n.nodeType) {
|
939 | if ("string" == typeof t && n.textContent.trim() === t) return void (s = n.parentElement);
|
940 | if ("string" == typeof r && n.textContent.includes(r)) return void (s = n.parentElement);
|
941 | } else {
|
942 | if ("SCRIPT" === n.nodeName || "STYLE" === n.nodeName) return;
|
943 | if (e(n.shadowRoot), n.childNodes) for (let t = 0; t < n.childNodes.length; t++) e(n.childNodes[t]);
|
944 | }
|
945 | }(e), s;
|
946 | }), t, r, s);
|
947 | return n ? n.asElement() : null;
|
948 | }(e, t, o, i), !a) return null;
|
949 | const u = new E2EElement(e, a);
|
950 | return await u.e2eSync(), u;
|
951 | }
|
952 |
|
953 | async function findAll(e, t, r) {
|
954 | const s = [], {lightSelector: n, shadowSelector: o} = getSelector(r), i = await t.$$(n);
|
955 | if (0 === i.length) return s;
|
956 | if (o) for (let t = 0; t < i.length; t++) {
|
957 | const r = i[t].executionContext(), n = await r.evaluateHandle(((e, t) => {
|
958 | if (!e.shadowRoot) throw new Error(`shadow root does not exist for element: ${e.tagName.toLowerCase()}`);
|
959 | return e.shadowRoot.querySelectorAll(t);
|
960 | }), i[t], o);
|
961 | await i[t].dispose();
|
962 | const a = await n.getProperties();
|
963 | await n.dispose();
|
964 | for (const t of a.values()) {
|
965 | const r = t.asElement();
|
966 | if (r) {
|
967 | const t = new E2EElement(e, r);
|
968 | await t.e2eSync(), s.push(t);
|
969 | }
|
970 | }
|
971 | } else for (let t = 0; t < i.length; t++) {
|
972 | const r = new E2EElement(e, i[t]);
|
973 | await r.e2eSync(), s.push(r);
|
974 | }
|
975 | return s;
|
976 | }
|
977 |
|
978 | function getSelector(e) {
|
979 | const t = {
|
980 | lightSelector: null,
|
981 | shadowSelector: null,
|
982 | text: null,
|
983 | contains: null
|
984 | };
|
985 | if ("string" == typeof e) {
|
986 | const r = e.split(">>>");
|
987 | t.lightSelector = r[0].trim(), t.shadowSelector = r.length > 1 ? r[1].trim() : null;
|
988 | } else if ("string" == typeof e.text) t.text = e.text.trim(); else {
|
989 | if ("string" != typeof e.contains) throw new Error(`invalid find selector: ${e}`);
|
990 | t.contains = e.contains.trim();
|
991 | }
|
992 | return t;
|
993 | }
|
994 |
|
995 | async function writeScreenshotData(e, t) {
|
996 | const r = function s(e, t) {
|
997 | const r = `${t}.json`;
|
998 | return path__default.default.join(e, r);
|
999 | }(e, t.id), n = JSON.stringify(t, null, 2);
|
1000 | await writeFile(r, n);
|
1001 | }
|
1002 |
|
1003 | function writeFile(e, t) {
|
1004 | return new Promise(((r, s) => {
|
1005 | fs__default.default.writeFile(e, t, (e => {
|
1006 | e ? s(e) : r();
|
1007 | }));
|
1008 | }));
|
1009 | }
|
1010 |
|
1011 | async function compareScreenshot(e, t, r, s, n, o, i, a) {
|
1012 | const l = `${crypto$3.createHash("md5").update(r).digest("hex")}.png`, c = path$2.join(t.imagesDir, l);
|
1013 | await async function u(e, t) {
|
1014 | await function r(e) {
|
1015 | return new Promise((t => {
|
1016 | fs__default.default.access(e, (e => t(!e)));
|
1017 | }));
|
1018 | }(e) || await writeFile(e, t);
|
1019 | }(c, r), r = null, i && (i = normalizePath(path$2.relative(t.rootDir, i)));
|
1020 | const d = function h(e, t) {
|
1021 | if ("string" != typeof t || 0 === t.trim().length) throw new Error("invalid test description");
|
1022 | const r = crypto$3.createHash("md5");
|
1023 | return r.update(t + ":"), r.update(e.userAgent + ":"), r.update(e.viewport.width + ":"),
|
1024 | r.update(e.viewport.height + ":"), r.update(e.viewport.deviceScaleFactor + ":"),
|
1025 | r.update(e.viewport.hasTouch + ":"), r.update(e.viewport.isMobile + ":"), r.digest("hex").slice(0, 8).toLowerCase();
|
1026 | }(e, s), p = {
|
1027 | id: d,
|
1028 | image: l,
|
1029 | device: e.device,
|
1030 | userAgent: e.userAgent,
|
1031 | desc: s,
|
1032 | testPath: i,
|
1033 | width: n,
|
1034 | height: o,
|
1035 | deviceScaleFactor: e.viewport.deviceScaleFactor,
|
1036 | hasTouch: e.viewport.hasTouch,
|
1037 | isLandscape: e.viewport.isLandscape,
|
1038 | isMobile: e.viewport.isMobile,
|
1039 | diff: {
|
1040 | id: d,
|
1041 | desc: s,
|
1042 | imageA: l,
|
1043 | imageB: l,
|
1044 | mismatchedPixels: 0,
|
1045 | device: e.device,
|
1046 | userAgent: e.userAgent,
|
1047 | width: n,
|
1048 | height: o,
|
1049 | deviceScaleFactor: e.viewport.deviceScaleFactor,
|
1050 | hasTouch: e.viewport.hasTouch,
|
1051 | isLandscape: e.viewport.isLandscape,
|
1052 | isMobile: e.viewport.isMobile,
|
1053 | allowableMismatchedPixels: t.allowableMismatchedPixels,
|
1054 | allowableMismatchedRatio: t.allowableMismatchedRatio,
|
1055 | testPath: i
|
1056 | }
|
1057 | };
|
1058 | if (t.updateMaster) return await writeScreenshotData(t.currentBuildDir, p), p.diff;
|
1059 | const f = t.masterScreenshots[p.id];
|
1060 | if (!f) return await writeScreenshotData(t.currentBuildDir, p), p.diff;
|
1061 | if (p.diff.imageA = f, p.diff.imageA !== p.diff.imageB) {
|
1062 | p.diff.cacheKey = function m(e, t, r) {
|
1063 | const s = crypto$3.createHash("md5");
|
1064 | return s.update(`${e}:${t}:${r}`), s.digest("hex").slice(0, 10);
|
1065 | }(p.diff.imageA, p.diff.imageB, a);
|
1066 | const r = t.cache[p.diff.cacheKey];
|
1067 | if ("number" != typeof r || isNaN(r)) {
|
1068 | const r = Math.round(e.viewport.width * e.viewport.deviceScaleFactor), s = Math.round(e.viewport.height * e.viewport.deviceScaleFactor), n = {
|
1069 | imageAPath: path$2.join(t.imagesDir, p.diff.imageA),
|
1070 | imageBPath: path$2.join(t.imagesDir, p.diff.imageB),
|
1071 | width: r,
|
1072 | height: s,
|
1073 | pixelmatchThreshold: a
|
1074 | };
|
1075 | p.diff.mismatchedPixels = await async function g(e, t) {
|
1076 | return new Promise(((r, s) => {
|
1077 | const n = .5 * jasmine.DEFAULT_TIMEOUT_INTERVAL, o = setTimeout((() => {
|
1078 | s(`getMismatchedPixels timeout: ${n}ms`);
|
1079 | }), n);
|
1080 | try {
|
1081 | const n = {
|
1082 | execArgv: process.execArgv.filter((e => !/^--(debug|inspect)/.test(e))),
|
1083 | env: process.env,
|
1084 | cwd: process.cwd(),
|
1085 | stdio: [ "pipe", "pipe", "pipe", "ipc" ]
|
1086 | }, i = child_process$2.fork(e, [], n);
|
1087 | i.on("message", (e => {
|
1088 | i.kill(), clearTimeout(o), r(e);
|
1089 | })), i.on("error", (e => {
|
1090 | clearTimeout(o), s(e);
|
1091 | })), i.send(t);
|
1092 | } catch (e) {
|
1093 | clearTimeout(o), s(`getMismatchedPixels error: ${e}`);
|
1094 | }
|
1095 | }));
|
1096 | }(t.pixelmatchModulePath, n);
|
1097 | } else p.diff.mismatchedPixels = r;
|
1098 | }
|
1099 | return await writeScreenshotData(t.currentBuildDir, p), p.diff;
|
1100 | }
|
1101 |
|
1102 | async function e2eGoTo(e, t, r = {}) {
|
1103 | if (e.isClosed()) throw new Error("e2eGoTo unavailable: page already closed");
|
1104 | if ("string" != typeof t) throw new Error("invalid gotoTest() url");
|
1105 | if (!t.startsWith("/")) throw new Error("gotoTest() url must start with /");
|
1106 | const s = env.__STENCIL_BROWSER_URL__;
|
1107 | if ("string" != typeof s) throw new Error("invalid gotoTest() browser url");
|
1108 | const n = s + t.substring(1);
|
1109 | r.waitUntil || (r.waitUntil = env.__STENCIL_BROWSER_WAIT_UNTIL);
|
1110 | const o = await e._e2eGoto(n, r);
|
1111 | if (!o.ok()) throw new Error(`Testing unable to load ${t}, HTTP status: ${o.status()}`);
|
1112 | return await waitForStencil(e, r), o;
|
1113 | }
|
1114 |
|
1115 | async function e2eSetContent(e, t, r = {}) {
|
1116 | if (e.isClosed()) throw new Error("e2eSetContent unavailable: page already closed");
|
1117 | if ("string" != typeof t) throw new Error("invalid e2eSetContent() html");
|
1118 | const s = [], n = env.__STENCIL_APP_SCRIPT_URL__;
|
1119 | if ("string" != typeof n) throw new Error("invalid e2eSetContent() app script url");
|
1120 | s.push("<!doctype html>"), s.push("<html>"), s.push("<head>");
|
1121 | const o = env.__STENCIL_APP_STYLE_URL__;
|
1122 | "string" == typeof o && s.push(`<link rel="stylesheet" href="${o}">`), s.push(`<script type="module" src="${n}"><\/script>`),
|
1123 | s.push("</head>"), s.push("<body>"), s.push(t), s.push("</body>"), s.push("</html>");
|
1124 | const i = env.__STENCIL_BROWSER_URL__;
|
1125 | await e.setRequestInterception(!0), e.on("request", (e => {
|
1126 | i === e.url() ? e.respond({
|
1127 | status: 200,
|
1128 | contentType: "text/html",
|
1129 | body: s.join("\n")
|
1130 | }) : e.continue();
|
1131 | })), r.waitUntil || (r.waitUntil = env.__STENCIL_BROWSER_WAIT_UNTIL);
|
1132 | const a = await e._e2eGoto(i, r);
|
1133 | if (!a.ok()) throw new Error("Testing unable to load content");
|
1134 | return await waitForStencil(e, r), a;
|
1135 | }
|
1136 |
|
1137 | async function waitForStencil(e, t) {
|
1138 | try {
|
1139 | const r = "number" == typeof t.timeout ? t.timeout : 4750;
|
1140 | await e.waitForFunction("window.stencilAppLoaded", {
|
1141 | timeout: r
|
1142 | });
|
1143 | } catch (e) {
|
1144 | throw new Error("App did not load in allowed time. Please ensure the content loads a stencil application.");
|
1145 | }
|
1146 | }
|
1147 |
|
1148 | async function waitForChanges(e) {
|
1149 | try {
|
1150 | if (e.isClosed()) return;
|
1151 | if (await Promise.all(e._e2eElements.map((e => e.e2eRunActions()))), e.isClosed()) return;
|
1152 | if (await e.evaluate((() => new Promise((e => {
|
1153 | requestAnimationFrame((() => {
|
1154 | const t = [], r = (e, t) => {
|
1155 | if (null != e) {
|
1156 | "shadowRoot" in e && e.shadowRoot instanceof ShadowRoot && r(e.shadowRoot, t);
|
1157 | const s = e.children, n = s.length;
|
1158 | for (let e = 0; e < n; e++) {
|
1159 | const n = s[e];
|
1160 | null != n && (n.tagName.includes("-") && "function" == typeof n.componentOnReady && t.push(n.componentOnReady()),
|
1161 | r(n, t));
|
1162 | }
|
1163 | }
|
1164 | };
|
1165 | r(document.documentElement, t), Promise.all(t).then((() => {
|
1166 | e();
|
1167 | })).catch((() => {
|
1168 | e();
|
1169 | }));
|
1170 | }));
|
1171 | })))), e.isClosed()) return;
|
1172 | "function" == typeof e.waitForTimeout ? await e.waitForTimeout(100) : await e.waitFor(100),
|
1173 | await Promise.all(e._e2eElements.map((e => e.e2eSync())));
|
1174 | } catch (e) {}
|
1175 | }
|
1176 |
|
1177 | function serializeConsoleMessage(e) {
|
1178 | return `${e.text()} ${function t(e) {
|
1179 | let t = "";
|
1180 | return e && e.url && (t = `\nLocation: ${e.url}`, e.lineNumber && (t += `:${e.lineNumber}`),
|
1181 | e.columnNumber && (t += `:${e.columnNumber}`)), t;
|
1182 | }(e.location())}`;
|
1183 | }
|
1184 |
|
1185 | var posix, pathBrowserify, caller, pathParse, parse, getNodeModulesDirs, nodeModulesPaths, normalizeOptions, ERROR_MESSAGE, slice, toStr, implementation, functionBind, src, isCoreModule, realpathFS$1, defaultIsFile$1, defaultIsDir$1, defaultRealpath, maybeRealpath, defaultReadPackage, getPackageCandidates$1, async, current, core, mod, core_1, isCore, realpathFS, defaultIsFile, defaultIsDir, defaultRealpathSync, maybeRealpathSync, defaultReadPackageSync, getPackageCandidates, sync, resolve;
|
1186 |
|
1187 | const path$2 = require("path"), index_js = _lazyRequire("../dev-server/index.js"), stencil_js = require("../compiler/stencil.js"), appData = _lazyRequire("@stencil/core/internal/app-data"), index_cjs = _lazyRequire("../mock-doc/index.cjs"), testing = _lazyRequire("@stencil/core/internal/testing"), process$3 = require("process"), os$2 = require("os"), fs$2 = require("fs"), crypto$3 = require("crypto"), child_process$2 = require("child_process"), path__default = _interopDefaultLegacy(path$2), process__namespace = _interopNamespace(process$3), os__namespace = _interopNamespace(os$2), fs__default = _interopDefaultLegacy(fs$2), formatComponentRuntimeMembers = (e, t = !0) => ({
|
1188 | ...formatPropertiesRuntimeMember(e.properties),
|
1189 | ...formatStatesRuntimeMember(e.states),
|
1190 | ...t ? formatMethodsRuntimeMember(e.methods) : {}
|
1191 | }), formatPropertiesRuntimeMember = e => {
|
1192 | const t = {};
|
1193 | return e.forEach((e => {
|
1194 | t[e.name] = trimFalsy([ formatFlags(e), formatAttrName(e) ]);
|
1195 | })), t;
|
1196 | }, formatFlags = e => {
|
1197 | let t = formatPropType(e.type);
|
1198 | return e.mutable && (t |= 1024), e.reflect && (t |= 512), t;
|
1199 | }, formatAttrName = e => {
|
1200 | if ("string" == typeof e.attribute) {
|
1201 | if (e.name === e.attribute) return;
|
1202 | return e.attribute;
|
1203 | }
|
1204 | }, formatPropType = e => "string" === e ? 1 : "number" === e ? 2 : "boolean" === e ? 4 : "any" === e ? 8 : 16, formatStatesRuntimeMember = e => {
|
1205 | const t = {};
|
1206 | return e.forEach((e => {
|
1207 | t[e.name] = [ 32 ];
|
1208 | })), t;
|
1209 | }, formatMethodsRuntimeMember = e => {
|
1210 | const t = {};
|
1211 | return e.forEach((e => {
|
1212 | t[e.name] = [ 64 ];
|
1213 | })), t;
|
1214 | }, formatHostListeners = e => e.listeners.map((e => [ computeListenerFlags(e), e.name, e.method ])), computeListenerFlags = e => {
|
1215 | let t = 0;
|
1216 | switch (e.capture && (t |= 2), e.passive && (t |= 1), e.target) {
|
1217 | case "document":
|
1218 | t |= 4;
|
1219 | break;
|
1220 |
|
1221 | case "window":
|
1222 | t |= 8;
|
1223 | break;
|
1224 |
|
1225 | case "body":
|
1226 | t |= 16;
|
1227 | break;
|
1228 |
|
1229 | case "parent":
|
1230 | t |= 32;
|
1231 | }
|
1232 | return t;
|
1233 | }, trimFalsy = e => {
|
1234 | const t = e;
|
1235 | for (let e = t.length - 1; e >= 0 && !t[e]; e--) t.pop();
|
1236 | return t;
|
1237 | }, noop = () => {}, isFunction = e => "function" == typeof e, isString = e => "string" == typeof e, isIterable = e => (e => null != e)(e) && isFunction(e[Symbol.iterator]), windowsPathRegex = /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?[\\/]$/, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)), normalizePath = e => {
|
1238 | if ("string" != typeof e) throw new Error("invalid path to normalize");
|
1239 | e = normalizeSlashes(e.trim());
|
1240 | const t = pathComponents(e, getRootLength(e)), r = reducePathComponents(t), s = r[0], n = r[1], o = s + r.slice(1).join("/");
|
1241 | return "" === o ? "." : "" === s && n && e.includes("/") && !n.startsWith(".") && !n.startsWith("@") ? "./" + o : o;
|
1242 | }, normalizeSlashes = e => e.replace(backslashRegExp, "/"), backslashRegExp = /\\/g, reducePathComponents = e => {
|
1243 | if (!Array.isArray(e) || 0 === e.length) return [];
|
1244 | const t = [ e[0] ];
|
1245 | for (let r = 1; r < e.length; r++) {
|
1246 | const s = e[r];
|
1247 | if (s && "." !== s) {
|
1248 | if (".." === s) if (t.length > 1) {
|
1249 | if (".." !== t[t.length - 1]) {
|
1250 | t.pop();
|
1251 | continue;
|
1252 | }
|
1253 | } else if (t[0]) continue;
|
1254 | t.push(s);
|
1255 | }
|
1256 | }
|
1257 | return t;
|
1258 | }, getRootLength = e => {
|
1259 | const t = getEncodedRootLength(e);
|
1260 | return t < 0 ? ~t : t;
|
1261 | }, getEncodedRootLength = e => {
|
1262 | if (!e) return 0;
|
1263 | const t = e.charCodeAt(0);
|
1264 | if (47 === t || 92 === t) {
|
1265 | if (e.charCodeAt(1) !== t) return 1;
|
1266 | const r = e.indexOf(47 === t ? "/" : "\\", 2);
|
1267 | return r < 0 ? e.length : r + 1;
|
1268 | }
|
1269 | if (isVolumeCharacter(t) && 58 === e.charCodeAt(1)) {
|
1270 | const t = e.charCodeAt(2);
|
1271 | if (47 === t || 92 === t) return 3;
|
1272 | if (2 === e.length) return 2;
|
1273 | }
|
1274 | const r = e.indexOf("://");
|
1275 | if (-1 !== r) {
|
1276 | const t = r + "://".length, s = e.indexOf("/", t);
|
1277 | if (-1 !== s) {
|
1278 | const n = e.slice(0, r), o = e.slice(t, s);
|
1279 | if ("file" === n && ("" === o || "localhost" === o) && isVolumeCharacter(e.charCodeAt(s + 1))) {
|
1280 | const t = getFileUrlVolumeSeparatorEnd(e, s + 2);
|
1281 | if (-1 !== t) {
|
1282 | if (47 === e.charCodeAt(t)) return ~(t + 1);
|
1283 | if (t === e.length) return ~t;
|
1284 | }
|
1285 | }
|
1286 | return ~(s + 1);
|
1287 | }
|
1288 | return ~e.length;
|
1289 | }
|
1290 | return 0;
|
1291 | }, isVolumeCharacter = e => e >= 97 && e <= 122 || e >= 65 && e <= 90, getFileUrlVolumeSeparatorEnd = (e, t) => {
|
1292 | const r = e.charCodeAt(t);
|
1293 | if (58 === r) return t + 1;
|
1294 | if (37 === r && 51 === e.charCodeAt(t + 1)) {
|
1295 | const r = e.charCodeAt(t + 2);
|
1296 | if (97 === r || 65 === r) return t + 3;
|
1297 | }
|
1298 | return -1;
|
1299 | }, pathComponents = (e, t) => {
|
1300 | const r = e.substring(0, t), s = e.substring(t).split("/"), n = s.length;
|
1301 | return n > 0 && !s[n - 1] && s.pop(), [ r, ...s ];
|
1302 | }, normalizeFsPath = e => normalizePath(e.split("?")[0].replace(/\0/g, "")), flattenDiagnosticMessageText = (e, t) => {
|
1303 | if ("string" == typeof t) return t;
|
1304 | if (void 0 === t) return "";
|
1305 | const r = [], s = e.file.fileName.includes("stencil.config");
|
1306 | s && r.push(2322);
|
1307 | let n = "";
|
1308 | if (!r.includes(t.code) && (n = t.messageText, isIterable(t.next))) for (const r of t.next) n += flattenDiagnosticMessageText(e, r);
|
1309 | return s && (n = n.replace("type 'StencilConfig'", "Stencil Config"), n = n.replace("Object literal may only specify known properties, but ", ""),
|
1310 | n = n.replace("Object literal may only specify known properties, and ", "")), n.trim();
|
1311 | }, isOutputTargetDistLazy = e => e.type === DIST_LAZY, isOutputTargetWww = e => e.type === WWW, DIST_LAZY = "dist-lazy", WWW = "www", isJest27TransformOptions = e => null != e && "object" == typeof e && e.hasOwnProperty("config");
|
1312 |
|
1313 | let _tsCompilerOptions = null, _tsCompilerOptionsKey = null;
|
1314 |
|
1315 | const jestPreprocessor = {
|
1316 | process(e, t, r, s) {
|
1317 | if (isJest27TransformOptions(r) && (s = r.config), !s) throw "Unable to find Jest transformation options.";
|
1318 | if (function n(e, t) {
|
1319 | var r;
|
1320 | const s = (null !== (r = e.split(".").pop()) && void 0 !== r ? r : "").toLowerCase().split("?")[0];
|
1321 | if ("ts" === s || "tsx" === s || "jsx" === s) return !0;
|
1322 | if ("mjs" === s) return !0;
|
1323 | if ("js" === s) {
|
1324 | if (t.includes("import ") || t.includes("import.") || t.includes("import(")) return !0;
|
1325 | if (t.includes("export ")) return !0;
|
1326 | }
|
1327 | return "css" === s;
|
1328 | }(t, e)) {
|
1329 | const r = {
|
1330 | file: t,
|
1331 | currentDirectory: s.rootDir
|
1332 | }, n = getCompilerOptions(s.rootDir);
|
1333 | n && (n.baseUrl && (r.baseUrl = n.baseUrl), n.paths && (r.paths = n.paths));
|
1334 | const o = transpile(e, r), i = o.diagnostics.some((e => "error" === e.level));
|
1335 | if (o.diagnostics && i) {
|
1336 | const e = o.diagnostics.map(formatDiagnostic).join("\n\n");
|
1337 | throw new Error(e);
|
1338 | }
|
1339 | return o.code;
|
1340 | }
|
1341 | return e;
|
1342 | },
|
1343 | getCacheKey(e, t, r, s) {
|
1344 | if (isJest27TransformOptions(r) && (s = r.config), !s) throw "Unable to find Jest transformation options.";
|
1345 | if (!_tsCompilerOptionsKey) {
|
1346 | const e = getCompilerOptions(s.rootDir);
|
1347 | _tsCompilerOptionsKey = JSON.stringify(e);
|
1348 | }
|
1349 | return [ process.version, _tsCompilerOptionsKey, e, t, r, !!s.instrument, 7 ].join(":");
|
1350 | }
|
1351 | }, deepEqual = function e(t, r) {
|
1352 | if (t === r) return !0;
|
1353 | if (t && r && "object" == typeof t && "object" == typeof r) {
|
1354 | const s = Array.isArray(t), n = Array.isArray(r);
|
1355 | let o, i, a;
|
1356 | if (s && n) {
|
1357 | if (i = t.length, i != r.length) return !1;
|
1358 | for (o = i; 0 != o--; ) if (!e(t[o], r[o])) return !1;
|
1359 | return !0;
|
1360 | }
|
1361 | if (s != n) return !1;
|
1362 | const l = t instanceof Date, c = r instanceof Date;
|
1363 | if (l != c) return !1;
|
1364 | if (l && c) return t.getTime() == r.getTime();
|
1365 | const u = t instanceof RegExp, d = r instanceof RegExp;
|
1366 | if (u != d) return !1;
|
1367 | if (u && d) return t.toString() == r.toString();
|
1368 | const h = Object.keys(t);
|
1369 | if (i = h.length, i !== Object.keys(r).length) return !1;
|
1370 | for (o = i; 0 != o--; ) if (!Object.prototype.hasOwnProperty.call(r, h[o])) return !1;
|
1371 | for (o = i; 0 != o--; ) if (a = h[o], !e(t[a], r[a])) return !1;
|
1372 | return !0;
|
1373 | }
|
1374 | return t != t && r != r;
|
1375 | }, expectExtend = {
|
1376 | toEqualAttribute: function toEqualAttribute(e, t, r) {
|
1377 | if (!e) throw new Error("expect toMatchAttribute value is null");
|
1378 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
1379 | if (1 !== e.nodeType) throw new Error("expect toMatchAttribute value is not an element");
|
1380 | let s = e.getAttribute(t);
|
1381 | null != r && (r = String(r)), null != s && (s = String(s));
|
1382 | const n = r === s;
|
1383 | return {
|
1384 | message: () => `expected attribute ${t} "${r}" to ${n ? "not " : ""}equal "${s}"`,
|
1385 | pass: n
|
1386 | };
|
1387 | },
|
1388 | toEqualAttributes: function toEqualAttributes(e, t) {
|
1389 | if (!e) throw new Error("expect toEqualAttributes value is null");
|
1390 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
1391 | if (1 !== e.nodeType) throw new Error("expect toEqualAttributes value is not an element");
|
1392 | const r = Object.keys(t), s = r.every((r => {
|
1393 | let s = t[r];
|
1394 | return null != s && (s = String(s)), e.getAttribute(r) === s;
|
1395 | }));
|
1396 | return {
|
1397 | message: () => `expected attributes to ${s ? "not " : ""}equal ${r.map((e => `[${e}="${t[e]}"]`)).join(", ")}`,
|
1398 | pass: s
|
1399 | };
|
1400 | },
|
1401 | toEqualHtml: function toEqualHtml(e, t) {
|
1402 | return compareHtml(e, t, !0);
|
1403 | },
|
1404 | toEqualLightHtml: function toEqualLightHtml(e, t) {
|
1405 | return compareHtml(e, t, !1);
|
1406 | },
|
1407 | toEqualText: function toEqualText(e, t) {
|
1408 | if (null == e) throw new Error(`expect toEqualText() value is "${e}"`);
|
1409 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
1410 | let r;
|
1411 | 1 === e.nodeType ? r = e.textContent.replace(/\s\s+/g, " ").trim() : null != e && (r = String(e).replace(/\s\s+/g, " ").trim()),
|
1412 | "string" == typeof t && (t = t.replace(/\s\s+/g, " ").trim());
|
1413 | const s = r === t;
|
1414 | return {
|
1415 | message: () => `expected textContent "${t}" to ${s ? "not " : ""}equal "${r}"`,
|
1416 | pass: s
|
1417 | };
|
1418 | },
|
1419 | toHaveAttribute: function toHaveAttribute(e, t) {
|
1420 | if (!e) throw new Error("expect toHaveAttribute value is null");
|
1421 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
1422 | if (1 !== e.nodeType) throw new Error("expect toHaveAttribute value is not an element");
|
1423 | const r = e.hasAttribute(t);
|
1424 | return {
|
1425 | message: () => `expected to ${r ? "not " : ""}have the attribute "${t}"`,
|
1426 | pass: r
|
1427 | };
|
1428 | },
|
1429 | toHaveClass: function toHaveClass(e, t) {
|
1430 | if (!e) throw new Error("expect toHaveClass value is null");
|
1431 | if ("function" == typeof e.then) throw new Error("element must be a resolved value, not a promise, before it can be tested");
|
1432 | if (1 !== e.nodeType) throw new Error("expect toHaveClass value is not an element");
|
1433 | const r = e.classList.contains(t);
|
1434 | return {
|
1435 | message: () => `expected to ${r ? "not " : ""}have css class "${t}"`,
|
1436 | pass: r
|
1437 | };
|
1438 | },
|
1439 | toHaveClasses,
|
1440 | toMatchClasses: function toMatchClasses(e, t) {
|
1441 | let {pass: r} = toHaveClasses(e, t);
|
1442 | return r && (r = t.length === e.classList.length), {
|
1443 | message: () => `expected to ${r ? "not " : ""}match css classes "${t.join(" ")}", but className is "${e.className}"`,
|
1444 | pass: r
|
1445 | };
|
1446 | },
|
1447 | toHaveReceivedEvent: function toHaveReceivedEvent(e) {
|
1448 | if (!e) throw new Error("toHaveReceivedEvent event spy is null");
|
1449 | if ("function" == typeof e.then) throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
|
1450 | if (!e.eventName) throw new Error("toHaveReceivedEvent did not receive an event spy");
|
1451 | const t = e.events.length > 0;
|
1452 | return {
|
1453 | message: () => `expected to have ${t ? "not " : ""}called "${e.eventName}" event`,
|
1454 | pass: t
|
1455 | };
|
1456 | },
|
1457 | toHaveReceivedEventDetail: function toHaveReceivedEventDetail(e, t) {
|
1458 | if (!e) throw new Error("toHaveReceivedEventDetail event spy is null");
|
1459 | if ("function" == typeof e.then) throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
|
1460 | if (!e.eventName) throw new Error("toHaveReceivedEventDetail did not receive an event spy");
|
1461 | if (!e.lastEvent) throw new Error(`event "${e.eventName}" was not received`);
|
1462 | const r = deepEqual(e.lastEvent.detail, t);
|
1463 | return expect(e.lastEvent.detail).toEqual(t), {
|
1464 | message: () => `expected event "${e.eventName}" detail to ${r ? "not " : ""}equal`,
|
1465 | pass: r
|
1466 | };
|
1467 | },
|
1468 | toHaveReceivedEventTimes: function toHaveReceivedEventTimes(e, t) {
|
1469 | if (!e) throw new Error("toHaveReceivedEventTimes event spy is null");
|
1470 | if ("function" == typeof e.then) throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
|
1471 | if (!e.eventName) throw new Error("toHaveReceivedEventTimes did not receive an event spy");
|
1472 | return {
|
1473 | message: () => `expected event "${e.eventName}" to have been called ${t} times, but was called ${e.events.length} time${e.events.length > 1 ? "s" : ""}`,
|
1474 | pass: e.length === t
|
1475 | };
|
1476 | },
|
1477 | toHaveFirstReceivedEventDetail: function toHaveFirstReceivedEventDetail(e, t) {
|
1478 | if (!e) throw new Error("toHaveFirstReceivedEventDetail event spy is null");
|
1479 | if ("function" == typeof e.then) throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
|
1480 | if (!e.eventName) throw new Error("toHaveFirstReceivedEventDetail did not receive an event spy");
|
1481 | if (!e.firstEvent) throw new Error(`event "${e.eventName}" was not received`);
|
1482 | const r = deepEqual(e.firstEvent.detail, t);
|
1483 | return expect(e.lastEvent.detail).toEqual(t), {
|
1484 | message: () => `expected event "${e.eventName}" detail to ${r ? "not " : ""}equal`,
|
1485 | pass: r
|
1486 | };
|
1487 | },
|
1488 | toHaveNthReceivedEventDetail: function toHaveNthReceivedEventDetail(e, t, r) {
|
1489 | if (!e) throw new Error("toHaveNthReceivedEventDetail event spy is null");
|
1490 | if ("function" == typeof e.then) throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
|
1491 | if (!e.eventName) throw new Error("toHaveNthReceivedEventDetail did not receive an event spy");
|
1492 | if (!e.firstEvent) throw new Error(`event "${e.eventName}" was not received`);
|
1493 | const s = e.events[t];
|
1494 | if (!s) throw new Error(`event at index ${t} was not received`);
|
1495 | const n = deepEqual(s.detail, r);
|
1496 | return expect(s.detail).toEqual(r), {
|
1497 | message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
|
1498 | pass: n
|
1499 | };
|
1500 | },
|
1501 | toMatchScreenshot: function toMatchScreenshot(e, t = {}) {
|
1502 | if (!e) throw new Error("expect toMatchScreenshot value is null");
|
1503 | if ("function" == typeof e.then) throw new Error("expect(compare).toMatchScreenshot() must be a resolved value, not a promise, before it can be tested");
|
1504 | if ("number" != typeof e.mismatchedPixels) throw new Error("expect toMatchScreenshot() value is not a screenshot compare");
|
1505 | const r = e.device || e.userAgent;
|
1506 | if ("number" == typeof t.allowableMismatchedRatio) {
|
1507 | if (t.allowableMismatchedRatio < 0 || t.allowableMismatchedRatio > 1) throw new Error("expect toMatchScreenshot() allowableMismatchedRatio must be a value ranging from 0 to 1");
|
1508 | const s = e.mismatchedPixels / (e.width * e.deviceScaleFactor * (e.height * e.deviceScaleFactor));
|
1509 | return {
|
1510 | message: () => `${r}: screenshot has a mismatch ratio of "${s}" for "${e.desc}", but expected ratio to be less than "${t.allowableMismatchedRatio}"`,
|
1511 | pass: s <= t.allowableMismatchedRatio
|
1512 | };
|
1513 | }
|
1514 | if ("number" == typeof t.allowableMismatchedPixels) {
|
1515 | if (t.allowableMismatchedPixels < 0) throw new Error("expect toMatchScreenshot() allowableMismatchedPixels value must be a value that is 0 or greater");
|
1516 | return {
|
1517 | message: () => `${r}: screenshot has "${e.mismatchedPixels}" mismatched pixels for "${e.desc}", but expected less than "${t.allowableMismatchedPixels}" mismatched pixels`,
|
1518 | pass: e.mismatchedPixels <= t.allowableMismatchedPixels
|
1519 | };
|
1520 | }
|
1521 | if ("number" == typeof e.allowableMismatchedRatio) {
|
1522 | const t = e.mismatchedPixels / (e.width * e.deviceScaleFactor * (e.height * e.deviceScaleFactor));
|
1523 | return {
|
1524 | message: () => `${r}: screenshot has a mismatch ratio of "${t}" for "${e.desc}", but expected ratio to be less than "${e.allowableMismatchedRatio}"`,
|
1525 | pass: t <= e.allowableMismatchedRatio
|
1526 | };
|
1527 | }
|
1528 | if ("number" == typeof e.allowableMismatchedPixels) return {
|
1529 | message: () => `${r}: screenshot has "${e.mismatchedPixels}" mismatched pixels for "${e.desc}", but expected less than "${e.allowableMismatchedPixels}" mismatched pixels`,
|
1530 | pass: e.mismatchedPixels <= e.allowableMismatchedPixels
|
1531 | };
|
1532 | throw new Error("expect toMatchScreenshot() missing allowableMismatchedPixels in testing config");
|
1533 | }
|
1534 | };
|
1535 |
|
1536 | class MockHeaders {
|
1537 | constructor(e) {
|
1538 | if (this._values = [], "object" == typeof e) if ("function" == typeof e[Symbol.iterator]) {
|
1539 | const t = [];
|
1540 | for (const r of e) "function" == typeof r[Symbol.iterator] && t.push([ ...r ]);
|
1541 | for (const e of t) this.append(e[0], e[1]);
|
1542 | } else for (const t in e) this.append(t, e[t]);
|
1543 | }
|
1544 | append(e, t) {
|
1545 | this._values.push([ e, t + "" ]);
|
1546 | }
|
1547 | delete(e) {
|
1548 | e = e.toLowerCase();
|
1549 | for (let t = this._values.length - 1; t >= 0; t--) this._values[t][0].toLowerCase() === e && this._values.splice(t, 1);
|
1550 | }
|
1551 | entries() {
|
1552 | const e = [];
|
1553 | for (const t of this.keys()) e.push([ t, this.get(t) ]);
|
1554 | let t = -1;
|
1555 | return {
|
1556 | next: () => (t++, {
|
1557 | value: e[t],
|
1558 | done: !e[t]
|
1559 | }),
|
1560 | [Symbol.iterator]() {
|
1561 | return this;
|
1562 | }
|
1563 | };
|
1564 | }
|
1565 | forEach(e) {
|
1566 | for (const t of this.entries()) e(t[1], t[0]);
|
1567 | }
|
1568 | get(e) {
|
1569 | const t = [];
|
1570 | e = e.toLowerCase();
|
1571 | for (const r of this._values) r[0].toLowerCase() === e && t.push(r[1]);
|
1572 | return t.length > 0 ? t.join(", ") : null;
|
1573 | }
|
1574 | has(e) {
|
1575 | e = e.toLowerCase();
|
1576 | for (const t of this._values) if (t[0].toLowerCase() === e) return !0;
|
1577 | return !1;
|
1578 | }
|
1579 | keys() {
|
1580 | const e = [];
|
1581 | for (const t of this._values) {
|
1582 | const r = t[0].toLowerCase();
|
1583 | e.includes(r) || e.push(r);
|
1584 | }
|
1585 | let t = -1;
|
1586 | return {
|
1587 | next: () => (t++, {
|
1588 | value: e[t],
|
1589 | done: !e[t]
|
1590 | }),
|
1591 | [Symbol.iterator]() {
|
1592 | return this;
|
1593 | }
|
1594 | };
|
1595 | }
|
1596 | set(e, t) {
|
1597 | for (const r of this._values) if (r[0].toLowerCase() === e.toLowerCase()) return void (r[1] = t + "");
|
1598 | this.append(e, t);
|
1599 | }
|
1600 | values() {
|
1601 | const e = this._values;
|
1602 | let t = -1;
|
1603 | return {
|
1604 | next() {
|
1605 | t++;
|
1606 | const r = !e[t];
|
1607 | return {
|
1608 | value: r ? void 0 : e[t][1],
|
1609 | done: r
|
1610 | };
|
1611 | },
|
1612 | [Symbol.iterator]() {
|
1613 | return this;
|
1614 | }
|
1615 | };
|
1616 | }
|
1617 | [Symbol.iterator]() {
|
1618 | return this.entries();
|
1619 | }
|
1620 | }
|
1621 |
|
1622 | class MockRequest {
|
1623 | constructor(e, t = {}) {
|
1624 | this._method = "GET", this._url = "/", this.bodyUsed = !1, this.cache = "default",
|
1625 | this.credentials = "same-origin", this.integrity = "", this.keepalive = !1, this.mode = "cors",
|
1626 | this.redirect = "follow", this.referrer = "about:client", this.referrerPolicy = "",
|
1627 | "string" == typeof e ? this.url = e : e && (Object.assign(this, e), this.headers = new MockHeaders(e.headers)),
|
1628 | Object.assign(this, t), t.headers && (this.headers = new MockHeaders(t.headers)),
|
1629 | this.headers || (this.headers = new MockHeaders);
|
1630 | }
|
1631 | get url() {
|
1632 | return "string" == typeof this._url ? new URL(this._url, location.href).href : new URL("/", location.href).href;
|
1633 | }
|
1634 | set url(e) {
|
1635 | this._url = e;
|
1636 | }
|
1637 | get method() {
|
1638 | return "string" == typeof this._method ? this._method.toUpperCase() : "GET";
|
1639 | }
|
1640 | set method(e) {
|
1641 | this._method = e;
|
1642 | }
|
1643 | clone() {
|
1644 | const e = {
|
1645 | ...this
|
1646 | };
|
1647 | return e.headers = new MockHeaders(this.headers), new MockRequest(e);
|
1648 | }
|
1649 | }
|
1650 |
|
1651 | class MockResponse {
|
1652 | constructor(e, t = {}) {
|
1653 | this.ok = !0, this.status = 200, this.statusText = "", this.type = "default", this.url = "",
|
1654 | this._body = e, t && Object.assign(this, t), this.headers = new MockHeaders(t.headers);
|
1655 | }
|
1656 | async json() {
|
1657 | return JSON.parse(this._body);
|
1658 | }
|
1659 | async text() {
|
1660 | return this._body;
|
1661 | }
|
1662 | clone() {
|
1663 | const e = {
|
1664 | ...this
|
1665 | };
|
1666 | return e.headers = new MockHeaders(this.headers), new MockResponse(this._body, e);
|
1667 | }
|
1668 | }
|
1669 |
|
1670 | const mockedResponses = new Map, mockFetch = {
|
1671 | json(e, t) {
|
1672 | setMockedResponse(new MockResponse(JSON.stringify(e, null, 2), {
|
1673 | headers: new MockHeaders({
|
1674 | "Content-Type": "application/json"
|
1675 | })
|
1676 | }), t, !1);
|
1677 | },
|
1678 | text(e, t) {
|
1679 | setMockedResponse(new MockResponse(e, {
|
1680 | headers: new MockHeaders({
|
1681 | "Content-Type": "text/plain"
|
1682 | })
|
1683 | }), t, !1);
|
1684 | },
|
1685 | response(e, t) {
|
1686 | setMockedResponse(e, t, !1);
|
1687 | },
|
1688 | reject(e, t) {
|
1689 | setMockedResponse(e, t, !0);
|
1690 | },
|
1691 | reset: function mockFetchReset() {
|
1692 | mockedResponses.clear();
|
1693 | }
|
1694 | };
|
1695 |
|
1696 | class MockResponse404 extends MockResponse {
|
1697 | constructor() {
|
1698 | super("", {
|
1699 | headers: new MockHeaders({
|
1700 | "Content-Type": "text/plain"
|
1701 | })
|
1702 | }), this.ok = !1, this.status = 404, this.statusText = "Not Found";
|
1703 | }
|
1704 | async json() {
|
1705 | return {
|
1706 | status: 404,
|
1707 | statusText: "Not Found"
|
1708 | };
|
1709 | }
|
1710 | async text() {
|
1711 | return "Not Found";
|
1712 | }
|
1713 | }
|
1714 |
|
1715 | const FETCH_DEFAULT_PATH = "/mock-fetch-data", HtmlSerializer = {
|
1716 | print: e => index_cjs.serializeNodeToHtml(e, {
|
1717 | serializeShadowRoot: !0,
|
1718 | prettyHtml: !0,
|
1719 | outerHtml: !0
|
1720 | }),
|
1721 | test: e => null != e && (e instanceof HTMLElement || e instanceof index_cjs.MockNode)
|
1722 | };
|
1723 |
|
1724 | class BuildContext {
|
1725 | constructor(e, t) {
|
1726 | this.buildId = -1, this.buildMessages = [], this.buildResults = null, this.bundleBuildCount = 0,
|
1727 | this.collections = [], this.completedTasks = [], this.components = [], this.componentGraph = new Map,
|
1728 | this.data = {}, this.buildStats = void 0, this.diagnostics = [], this.dirsAdded = [],
|
1729 | this.dirsDeleted = [], this.entryModules = [], this.filesAdded = [], this.filesChanged = [],
|
1730 | this.filesDeleted = [], this.filesUpdated = [], this.filesWritten = [], this.globalStyle = void 0,
|
1731 | this.hasConfigChanges = !1, this.hasFinished = !1, this.hasHtmlChanges = !1, this.hasPrintedResults = !1,
|
1732 | this.hasServiceWorkerChanges = !1, this.hasScriptChanges = !0, this.hasStyleChanges = !0,
|
1733 | this.hydrateAppFilePath = null, this.indexBuildCount = 0, this.indexDoc = void 0,
|
1734 | this.isRebuild = !1, this.moduleFiles = [], this.outputs = [], this.packageJson = {},
|
1735 | this.packageJsonFilePath = null, this.pendingCopyTasks = [], this.requiresFullBuild = !0,
|
1736 | this.scriptsAdded = [], this.scriptsDeleted = [], this.startTime = Date.now(), this.styleBuildCount = 0,
|
1737 | this.stylesPromise = null, this.stylesUpdated = [], this.timeSpan = null, this.transpileBuildCount = 0,
|
1738 | this.config = e, this.compilerCtx = t, this.buildId = ++this.compilerCtx.activeBuildId,
|
1739 | this.debug = e.logger.debug.bind(e.logger);
|
1740 | }
|
1741 | start() {
|
1742 | const e = `${this.isRebuild ? "rebuild" : "build"}, ${this.config.fsNamespace}, ${this.config.devMode ? "dev" : "prod"} mode, started`, t = {
|
1743 | buildId: this.buildId,
|
1744 | messages: [],
|
1745 | progress: 0
|
1746 | };
|
1747 | this.compilerCtx.events.emit("buildLog", t), this.timeSpan = this.createTimeSpan(e),
|
1748 | this.timestamp = getBuildTimestamp(), this.debug(`start build, ${this.timestamp}`);
|
1749 | const r = {
|
1750 | buildId: this.buildId,
|
1751 | timestamp: this.timestamp
|
1752 | };
|
1753 | this.compilerCtx.events.emit("buildStart", r);
|
1754 | }
|
1755 | createTimeSpan(e, t) {
|
1756 | if (!this.hasFinished || t) {
|
1757 | t && this.config.watch && (e = `${this.config.logger.cyan("[" + this.buildId + "]")} ${e}`);
|
1758 | const r = this.config.logger.createTimeSpan(e, t, this.buildMessages);
|
1759 | if (!t && this.compilerCtx.events) {
|
1760 | const e = {
|
1761 | buildId: this.buildId,
|
1762 | messages: this.buildMessages,
|
1763 | progress: getProgress(this.completedTasks)
|
1764 | };
|
1765 | this.compilerCtx.events.emit("buildLog", e);
|
1766 | }
|
1767 | return {
|
1768 | duration: () => r.duration(),
|
1769 | finish: (e, s, n, o) => {
|
1770 | if ((!this.hasFinished || t) && (t && this.config.watch && (e = `${this.config.logger.cyan("[" + this.buildId + "]")} ${e}`),
|
1771 | r.finish(e, s, n, o), !t)) {
|
1772 | const e = {
|
1773 | buildId: this.buildId,
|
1774 | messages: this.buildMessages.slice(),
|
1775 | progress: getProgress(this.completedTasks)
|
1776 | };
|
1777 | this.compilerCtx.events.emit("buildLog", e);
|
1778 | }
|
1779 | return r.duration();
|
1780 | }
|
1781 | };
|
1782 | }
|
1783 | return {
|
1784 | duration: () => 0,
|
1785 | finish: () => 0
|
1786 | };
|
1787 | }
|
1788 | debug(e) {
|
1789 | this.config.logger.debug(e);
|
1790 | }
|
1791 | get hasError() {
|
1792 | return hasError(this.diagnostics);
|
1793 | }
|
1794 | get hasWarning() {
|
1795 | return null != (e = this.diagnostics) && 0 !== e.length && e.some((e => "warn" === e.level));
|
1796 | var e;
|
1797 | }
|
1798 | progress(e) {
|
1799 | this.completedTasks.push(e);
|
1800 | }
|
1801 | async validateTypesBuild() {
|
1802 | this.hasError || this.validateTypesPromise && (this.config.watch || (this.debug("build, non-watch, waiting on validateTypes"),
|
1803 | await this.validateTypesPromise, this.debug("build, non-watch, finished waiting on validateTypes")));
|
1804 | }
|
1805 | }
|
1806 |
|
1807 | const getBuildTimestamp = () => {
|
1808 | const e = new Date;
|
1809 | let t = e.getUTCFullYear() + "-";
|
1810 | return t += ("0" + (e.getUTCMonth() + 1)).slice(-2) + "-", t += ("0" + e.getUTCDate()).slice(-2) + "T",
|
1811 | t += ("0" + e.getUTCHours()).slice(-2) + ":", t += ("0" + e.getUTCMinutes()).slice(-2) + ":",
|
1812 | t += ("0" + e.getUTCSeconds()).slice(-2), t;
|
1813 | }, getProgress = e => {
|
1814 | let t = 0;
|
1815 | const r = Object.keys(ProgressTask);
|
1816 | return r.forEach(((r, s) => {
|
1817 | e.includes(ProgressTask[r]) && (t = s);
|
1818 | })), (t + 1) / r.length;
|
1819 | }, ProgressTask = {
|
1820 | emptyOutputTargets: {},
|
1821 | transpileApp: {},
|
1822 | generateStyles: {},
|
1823 | generateOutputTargets: {},
|
1824 | validateTypesBuild: {},
|
1825 | writeBuildFiles: {}
|
1826 | };
|
1827 |
|
1828 | class Cache {
|
1829 | constructor(e, t) {
|
1830 | this.config = e, this.cacheFs = t, this.failed = 0, this.skip = !1, this.sys = e.sys,
|
1831 | this.logger = e.logger;
|
1832 | }
|
1833 | async initCacheDir() {
|
1834 | if (!this.config._isTesting && this.config.cacheDir) {
|
1835 | if (!this.config.enableCache || !this.cacheFs) return this.config.logger.info("cache optimizations disabled"),
|
1836 | void this.clearDiskCache();
|
1837 | this.config.logger.debug(`cache enabled, cacheDir: ${this.config.cacheDir}`);
|
1838 | try {
|
1839 | const e = path$2.join(this.config.cacheDir, "_README.log");
|
1840 | await this.cacheFs.writeFile(e, CACHE_DIR_README);
|
1841 | } catch (e) {
|
1842 | this.logger.error(`Cache, initCacheDir: ${e}`), this.config.enableCache = !1;
|
1843 | }
|
1844 | }
|
1845 | }
|
1846 | async get(e) {
|
1847 | if (!this.config.enableCache || this.skip) return null;
|
1848 | if (this.failed >= MAX_FAILED) return this.skip || (this.skip = !0, this.logger.debug(`cache had ${this.failed} failed ops, skip disk ops for remander of build`)),
|
1849 | null;
|
1850 | let t;
|
1851 | try {
|
1852 | t = await this.cacheFs.readFile(this.getCacheFilePath(e)), this.failed = 0, this.skip = !1;
|
1853 | } catch (e) {
|
1854 | this.failed++, t = null;
|
1855 | }
|
1856 | return t;
|
1857 | }
|
1858 | async put(e, t) {
|
1859 | if (!this.config.enableCache) return !1;
|
1860 | let r;
|
1861 | try {
|
1862 | await this.cacheFs.writeFile(this.getCacheFilePath(e), t), r = !0;
|
1863 | } catch (e) {
|
1864 | this.failed++, r = !1;
|
1865 | }
|
1866 | return r;
|
1867 | }
|
1868 | async has(e) {
|
1869 | return "string" == typeof await this.get(e);
|
1870 | }
|
1871 | async createKey(e, ...t) {
|
1872 | return this.config.enableCache ? e + "_" + await this.sys.generateContentHash(JSON.stringify(t), 32) : e + 9999999 * Math.random();
|
1873 | }
|
1874 | async commit() {
|
1875 | this.config.enableCache && (this.skip = !1, this.failed = 0, await this.cacheFs.commit(),
|
1876 | await this.clearExpiredCache());
|
1877 | }
|
1878 | clear() {
|
1879 | null != this.cacheFs && this.cacheFs.clearCache();
|
1880 | }
|
1881 | async clearExpiredCache() {
|
1882 | if (null == this.cacheFs || null == this.sys.cacheStorage) return;
|
1883 | const e = Date.now(), t = await this.sys.cacheStorage.get(EXP_STORAGE_KEY);
|
1884 | if (null != t) {
|
1885 | if (e - t < ONE_DAY) return;
|
1886 | const r = this.cacheFs.sys, s = await r.readDir(this.config.cacheDir), n = s.map((e => path$2.join(this.config.cacheDir, e)));
|
1887 | let o = 0;
|
1888 | const i = n.map((async t => {
|
1889 | const s = (await r.stat(t)).mtimeMs;
|
1890 | e - s > ONE_WEEK && (await r.removeFile(t), o++);
|
1891 | }));
|
1892 | await Promise.all(i), this.logger.debug(`clearExpiredCache, cachedFileNames: ${s.length}, totalCleared: ${o}`);
|
1893 | }
|
1894 | this.logger.debug("clearExpiredCache, set last clear"), await this.sys.cacheStorage.set(EXP_STORAGE_KEY, e);
|
1895 | }
|
1896 | async clearDiskCache() {
|
1897 | null != this.cacheFs && await this.cacheFs.access(this.config.cacheDir) && (await this.cacheFs.remove(this.config.cacheDir),
|
1898 | await this.cacheFs.commit());
|
1899 | }
|
1900 | getCacheFilePath(e) {
|
1901 | return path$2.join(this.config.cacheDir, e) + ".log";
|
1902 | }
|
1903 | getMemoryStats() {
|
1904 | return null != this.cacheFs ? this.cacheFs.getMemoryStats() : null;
|
1905 | }
|
1906 | }
|
1907 |
|
1908 | const MAX_FAILED = 100, ONE_DAY = 864e5, ONE_WEEK = 7 * ONE_DAY, EXP_STORAGE_KEY = "last_clear_expired_cache", CACHE_DIR_README = '# Stencil Cache Directory\n\nThis directory contains files which the compiler has\ncached for faster builds. To disable caching, please set\n"enableCache: false" within the stencil config.\n\nTo change the cache directory, please update the\n"cacheDir" property within the stencil config.\n', getCommitInstructions = e => {
|
1909 | const t = {
|
1910 | filesToDelete: [],
|
1911 | filesToWrite: [],
|
1912 | filesToCopy: [],
|
1913 | dirsToDelete: [],
|
1914 | dirsToEnsure: []
|
1915 | };
|
1916 | e.forEach(((e, r) => {
|
1917 | if (!0 === e.queueWriteToDisk) {
|
1918 | if (!0 === e.isFile) {
|
1919 | t.filesToWrite.push(r);
|
1920 | const e = normalizePath(path$2.dirname(r));
|
1921 | t.dirsToEnsure.includes(e) || t.dirsToEnsure.push(e);
|
1922 | const s = t.dirsToDelete.indexOf(e);
|
1923 | s > -1 && t.dirsToDelete.splice(s, 1);
|
1924 | const n = t.filesToDelete.indexOf(r);
|
1925 | n > -1 && t.filesToDelete.splice(n, 1);
|
1926 | } else if (!0 === e.isDirectory) {
|
1927 | t.dirsToEnsure.includes(r) || t.dirsToEnsure.push(r);
|
1928 | const e = t.dirsToDelete.indexOf(r);
|
1929 | e > -1 && t.dirsToDelete.splice(e, 1);
|
1930 | }
|
1931 | } else if (!0 === e.queueDeleteFromDisk) e.isDirectory && !t.dirsToEnsure.includes(r) ? t.dirsToDelete.push(r) : e.isFile && !t.filesToWrite.includes(r) && t.filesToDelete.push(r); else if ("string" == typeof e.queueCopyFileToDest) {
|
1932 | const s = r, n = e.queueCopyFileToDest;
|
1933 | t.filesToCopy.push([ s, n ]);
|
1934 | const o = normalizePath(path$2.dirname(n));
|
1935 | t.dirsToEnsure.includes(o) || t.dirsToEnsure.push(o);
|
1936 | const i = t.dirsToDelete.indexOf(o);
|
1937 | i > -1 && t.dirsToDelete.splice(i, 1);
|
1938 | const a = t.filesToDelete.indexOf(n);
|
1939 | a > -1 && t.filesToDelete.splice(a, 1);
|
1940 | }
|
1941 | e.queueDeleteFromDisk = !1, e.queueWriteToDisk = !1;
|
1942 | }));
|
1943 | for (let e = 0, r = t.dirsToEnsure.length; e < r; e++) {
|
1944 | const r = t.dirsToEnsure[e].split("/");
|
1945 | for (let e = 2; e < r.length; e++) {
|
1946 | const s = r.slice(0, e).join("/");
|
1947 | !1 === t.dirsToEnsure.includes(s) && t.dirsToEnsure.push(s);
|
1948 | }
|
1949 | }
|
1950 | t.dirsToEnsure.sort(((e, t) => {
|
1951 | const r = e.split("/").length, s = t.split("/").length;
|
1952 | return r < s ? -1 : r > s ? 1 : e.length < t.length ? -1 : e.length > t.length ? 1 : 0;
|
1953 | })), t.dirsToDelete.sort(((e, t) => {
|
1954 | const r = e.split("/").length, s = t.split("/").length;
|
1955 | return r < s ? 1 : r > s ? -1 : e.length < t.length ? 1 : e.length > t.length ? -1 : 0;
|
1956 | }));
|
1957 | for (const e of t.dirsToEnsure) {
|
1958 | const r = t.dirsToDelete.indexOf(e);
|
1959 | r > -1 && t.dirsToDelete.splice(r, 1);
|
1960 | }
|
1961 | return t.dirsToDelete = t.dirsToDelete.filter((e => "/" !== e && !0 !== e.endsWith(":/"))),
|
1962 | t.dirsToEnsure = t.dirsToEnsure.filter((t => {
|
1963 | const r = e.get(t);
|
1964 | return (null == r || !0 !== r.exists || !0 !== r.isDirectory) && "/" !== t && !t.endsWith(":/");
|
1965 | })), t;
|
1966 | }, shouldIgnore = e => (e = e.trim().toLowerCase(), IGNORE.some((t => e.endsWith(t)))), IGNORE = [ ".ds_store", ".gitignore", "desktop.ini", "thumbs.db" ];
|
1967 |
|
1968 | (posix = {
|
1969 | resolve: function e() {
|
1970 | var t, r, s, n = "", o = !1;
|
1971 | for (r = arguments.length - 1; r >= -1 && !o; r--) r >= 0 ? s = arguments[r] : (void 0 === t && (t = process.cwd()),
|
1972 | s = t), assertPath(s), 0 !== s.length && (n = s + "/" + n, o = 47 === s.charCodeAt(0));
|
1973 | return n = normalizeStringPosix(n, !o), o ? n.length > 0 ? "/" + n : "/" : n.length > 0 ? n : ".";
|
1974 | },
|
1975 | normalize: function e(t) {
|
1976 | var r, s;
|
1977 | return assertPath(t), 0 === t.length ? "." : (r = 47 === t.charCodeAt(0), s = 47 === t.charCodeAt(t.length - 1),
|
1978 | 0 !== (t = normalizeStringPosix(t, !r)).length || r || (t = "."), t.length > 0 && s && (t += "/"),
|
1979 | r ? "/" + t : t);
|
1980 | },
|
1981 | isAbsolute: function e(t) {
|
1982 | return assertPath(t), t.length > 0 && 47 === t.charCodeAt(0);
|
1983 | },
|
1984 | join: function e() {
|
1985 | var t, r, s;
|
1986 | if (0 === arguments.length) return ".";
|
1987 | for (r = 0; r < arguments.length; ++r) assertPath(s = arguments[r]), s.length > 0 && (void 0 === t ? t = s : t += "/" + s);
|
1988 | return void 0 === t ? "." : posix.normalize(t);
|
1989 | },
|
1990 | relative: function e(t, r) {
|
1991 | var s, n, o, i, a, l, c, u, d, h;
|
1992 | if (assertPath(t), assertPath(r), t === r) return "";
|
1993 | if ((t = posix.resolve(t)) === (r = posix.resolve(r))) return "";
|
1994 | for (s = 1; s < t.length && 47 === t.charCodeAt(s); ++s) ;
|
1995 | for (o = (n = t.length) - s, i = 1; i < r.length && 47 === r.charCodeAt(i); ++i) ;
|
1996 | for (l = o < (a = r.length - i) ? o : a, c = -1, u = 0; u <= l; ++u) {
|
1997 | if (u === l) {
|
1998 | if (a > l) {
|
1999 | if (47 === r.charCodeAt(i + u)) return r.slice(i + u + 1);
|
2000 | if (0 === u) return r.slice(i + u);
|
2001 | } else o > l && (47 === t.charCodeAt(s + u) ? c = u : 0 === u && (c = 0));
|
2002 | break;
|
2003 | }
|
2004 | if ((d = t.charCodeAt(s + u)) !== r.charCodeAt(i + u)) break;
|
2005 | 47 === d && (c = u);
|
2006 | }
|
2007 | for (h = "", u = s + c + 1; u <= n; ++u) u !== n && 47 !== t.charCodeAt(u) || (0 === h.length ? h += ".." : h += "/..");
|
2008 | return h.length > 0 ? h + r.slice(i + c) : (i += c, 47 === r.charCodeAt(i) && ++i,
|
2009 | r.slice(i));
|
2010 | },
|
2011 | _makeLong: function e(t) {
|
2012 | return t;
|
2013 | },
|
2014 | dirname: function e(t) {
|
2015 | var r, s, n, o;
|
2016 | if (assertPath(t), 0 === t.length) return ".";
|
2017 | for (r = 47 === t.charCodeAt(0), s = -1, n = !0, o = t.length - 1; o >= 1; --o) if (47 === t.charCodeAt(o)) {
|
2018 | if (!n) {
|
2019 | s = o;
|
2020 | break;
|
2021 | }
|
2022 | } else n = !1;
|
2023 | return -1 === s ? r ? "/" : "." : r && 1 === s ? "//" : t.slice(0, s);
|
2024 | },
|
2025 | basename: function e(t, r) {
|
2026 | var s, n, o, i, a, l, c;
|
2027 | if (void 0 !== r && "string" != typeof r) throw new TypeError('"ext" argument must be a string');
|
2028 | if (assertPath(t), s = 0, n = -1, o = !0, void 0 !== r && r.length > 0 && r.length <= t.length) {
|
2029 | if (r.length === t.length && r === t) return "";
|
2030 | for (a = r.length - 1, l = -1, i = t.length - 1; i >= 0; --i) if (47 === (c = t.charCodeAt(i))) {
|
2031 | if (!o) {
|
2032 | s = i + 1;
|
2033 | break;
|
2034 | }
|
2035 | } else -1 === l && (o = !1, l = i + 1), a >= 0 && (c === r.charCodeAt(a) ? -1 == --a && (n = i) : (a = -1,
|
2036 | n = l));
|
2037 | return s === n ? n = l : -1 === n && (n = t.length), t.slice(s, n);
|
2038 | }
|
2039 | for (i = t.length - 1; i >= 0; --i) if (47 === t.charCodeAt(i)) {
|
2040 | if (!o) {
|
2041 | s = i + 1;
|
2042 | break;
|
2043 | }
|
2044 | } else -1 === n && (o = !1, n = i + 1);
|
2045 | return -1 === n ? "" : t.slice(s, n);
|
2046 | },
|
2047 | extname: function e(t) {
|
2048 | var r, s, n, o, i, a, l;
|
2049 | for (assertPath(t), r = -1, s = 0, n = -1, o = !0, i = 0, a = t.length - 1; a >= 0; --a) if (47 !== (l = t.charCodeAt(a))) -1 === n && (o = !1,
|
2050 | n = a + 1), 46 === l ? -1 === r ? r = a : 1 !== i && (i = 1) : -1 !== r && (i = -1); else if (!o) {
|
2051 | s = a + 1;
|
2052 | break;
|
2053 | }
|
2054 | return -1 === r || -1 === n || 0 === i || 1 === i && r === n - 1 && r === s + 1 ? "" : t.slice(r, n);
|
2055 | },
|
2056 | format: function e(t) {
|
2057 | if (null === t || "object" != typeof t) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t);
|
2058 | return function r(e, t) {
|
2059 | var r = t.dir || t.root, s = t.base || (t.name || "") + (t.ext || "");
|
2060 | return r ? r === t.root ? r + s : r + e + s : s;
|
2061 | }("/", t);
|
2062 | },
|
2063 | parse: function e(t) {
|
2064 | var r, s, n, o, i, a, l, c, u, d;
|
2065 | if (assertPath(t), r = {
|
2066 | root: "",
|
2067 | dir: "",
|
2068 | base: "",
|
2069 | ext: "",
|
2070 | name: ""
|
2071 | }, 0 === t.length) return r;
|
2072 | for ((n = 47 === (s = t.charCodeAt(0))) ? (r.root = "/", o = 1) : o = 0, i = -1,
|
2073 | a = 0, l = -1, c = !0, u = t.length - 1, d = 0; u >= o; --u) if (47 !== (s = t.charCodeAt(u))) -1 === l && (c = !1,
|
2074 | l = u + 1), 46 === s ? -1 === i ? i = u : 1 !== d && (d = 1) : -1 !== i && (d = -1); else if (!c) {
|
2075 | a = u + 1;
|
2076 | break;
|
2077 | }
|
2078 | return -1 === i || -1 === l || 0 === d || 1 === d && i === l - 1 && i === a + 1 ? -1 !== l && (r.base = r.name = 0 === a && n ? t.slice(1, l) : t.slice(a, l)) : (0 === a && n ? (r.name = t.slice(1, i),
|
2079 | r.base = t.slice(1, l)) : (r.name = t.slice(a, i), r.base = t.slice(a, l)), r.ext = t.slice(i, l)),
|
2080 | a > 0 ? r.dir = t.slice(0, a - 1) : n && (r.dir = "/"), r;
|
2081 | },
|
2082 | sep: "/",
|
2083 | delimiter: ":",
|
2084 | win32: null,
|
2085 | posix: null
|
2086 | }).posix = posix, pathBrowserify = posix;
|
2087 |
|
2088 | const buildEvents = () => {
|
2089 | const e = [], t = t => {
|
2090 | const r = e.findIndex((e => e.callback === t));
|
2091 | return r > -1 && (e.splice(r, 1), !0);
|
2092 | };
|
2093 | return {
|
2094 | emit: (t, r) => {
|
2095 | const s = t.toLowerCase().trim(), n = e.slice();
|
2096 | for (const e of n) if (null == e.eventName) try {
|
2097 | e.callback(t, r);
|
2098 | } catch (e) {
|
2099 | console.error(e);
|
2100 | } else if (e.eventName === s) try {
|
2101 | e.callback(r);
|
2102 | } catch (e) {
|
2103 | console.error(e);
|
2104 | }
|
2105 | },
|
2106 | on: (r, s) => {
|
2107 | if ("function" == typeof r) {
|
2108 | const s = null, n = r;
|
2109 | return e.push({
|
2110 | eventName: s,
|
2111 | callback: n
|
2112 | }), () => t(n);
|
2113 | }
|
2114 | if ("string" == typeof r && "function" == typeof s) {
|
2115 | const n = r.toLowerCase().trim(), o = s;
|
2116 | return e.push({
|
2117 | eventName: n,
|
2118 | callback: o
|
2119 | }), () => t(o);
|
2120 | }
|
2121 | return () => !1;
|
2122 | },
|
2123 | unsubscribeAll: () => {
|
2124 | e.length = 0;
|
2125 | }
|
2126 | };
|
2127 | }, IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin);
|
2128 |
|
2129 | IS_NODE_ENV && process.platform;
|
2130 |
|
2131 | const IS_BROWSER_ENV = "undefined" != typeof location && "undefined" != typeof navigator && "undefined" != typeof XMLHttpRequest, IS_WEB_WORKER_ENV = IS_BROWSER_ENV && "undefined" != typeof self && "function" == typeof self.importScripts, HAS_WEB_WORKER = IS_BROWSER_ENV && "function" == typeof Worker, IS_FETCH_ENV = "function" == typeof fetch;
|
2132 |
|
2133 | IS_NODE_ENV && require, IS_NODE_ENV && process.cwd;
|
2134 |
|
2135 | const YELLOW = "#f39c12", RED = "#c0392b", BLUE = "#3498db", COMMON_DIR_MODULE_EXTS = [ ".tsx", ".ts", ".mjs", ".js", ".jsx", ".json", ".md" ], COMMON_DIR_FILENAMES = [ "package.json", "index.js", "index.mjs" ], getCommonDirName = (e, t) => e + "/" + t, isCommonDirModuleFile = e => COMMON_DIR_MODULE_EXTS.some((t => e.endsWith(t))), shouldFetchModule = e => IS_FETCH_ENV && IS_BROWSER_ENV && isNodeModulePath(e), isNodeModulePath = e => normalizePath(e).split("/").includes("node_modules"), getPackageDirPath = (e, t) => {
|
2136 | const r = normalizePath(e).split("/"), s = (e => {
|
2137 | e.startsWith("~") && (e = e.substring(1));
|
2138 | const t = e.split("/"), r = {
|
2139 | moduleId: null,
|
2140 | filePath: null,
|
2141 | scope: null,
|
2142 | scopeSubModuleId: null
|
2143 | };
|
2144 | return e.startsWith("@") && t.length > 1 ? (r.moduleId = t.slice(0, 2).join("/"),
|
2145 | r.filePath = t.slice(2).join("/"), r.scope = t[0], r.scopeSubModuleId = t[1]) : (r.moduleId = t[0],
|
2146 | r.filePath = t.slice(1).join("/")), r;
|
2147 | })(t);
|
2148 | for (let e = r.length - 1; e >= 1; e--) if ("node_modules" === r[e - 1]) if (s.scope) {
|
2149 | if (r[e] === s.scope && r[e + 1] === s.scopeSubModuleId) return r.slice(0, e + 2).join("/");
|
2150 | } else if (r[e] === s.moduleId) return r.slice(0, e + 1).join("/");
|
2151 | return null;
|
2152 | }, packageVersions = new Map, known404Urls = new Set, getCommonDirUrl = (e, t, r, s) => getNodeModuleFetchUrl(e, t, r) + "/" + s, getNodeModuleFetchUrl = (e, t, r) => {
|
2153 | let s = (r = normalizePath(r)).split("/").filter((e => e.length));
|
2154 | const n = s.lastIndexOf("node_modules");
|
2155 | n > -1 && n < s.length - 1 && (s = s.slice(n + 1));
|
2156 | let o = s.shift();
|
2157 | o.startsWith("@") && (o += "/" + s.shift());
|
2158 | const i = s.join("/");
|
2159 | return "@stencil/core" === o ? ((e, t) => {
|
2160 | let r = (t = normalizePath(t)).split("/");
|
2161 | const s = r.lastIndexOf("node_modules");
|
2162 | s > -1 && s < r.length - 1 && (r = r.slice(s + 1), r = r[0].startsWith("@") ? r.slice(2) : r.slice(1),
|
2163 | t = r.join("/"));
|
2164 | const n = new URL("../", e).href;
|
2165 | return new URL("./" + t, n).href;
|
2166 | })(e.getCompilerExecutingPath(), i) : e.getRemoteModuleUrl({
|
2167 | moduleId: o,
|
2168 | version: t.get(o),
|
2169 | path: i
|
2170 | });
|
2171 | }, knownUrlSkips = [ "/@stencil/core/internal.js", "/@stencil/core/internal.json", "/@stencil/core/internal.mjs", "/@stencil/core/internal/stencil-core.js/index.json", "/@stencil/core/internal/stencil-core.js.json", "/@stencil/core/internal/stencil-core.js/package.json", "/@stencil/core.js", "/@stencil/core.json", "/@stencil/core.mjs", "/@stencil/core.css", "/@stencil/core/index.js", "/@stencil/core/index.json", "/@stencil/core/index.mjs", "/@stencil/core/index.css", "/@stencil/package.json" ], fetchModuleAsync = async (e, t, r, s, n) => {
|
2172 | if (!((e => {
|
2173 | if (!(e => e.endsWith(".d.ts"))(t = e) && t.endsWith(".ts") || (e => e.endsWith(".tsx"))(e)) return !0;
|
2174 | var t;
|
2175 | const r = e.split("/"), s = r[r.length - 2], n = r[r.length - 1];
|
2176 | return !("node_modules" !== s || !isCommonDirModuleFile(n));
|
2177 | })(n) || known404Urls.has(s) || (e => knownUrlSkips.some((t => e.endsWith(t))))(s))) try {
|
2178 | const o = await ((e, t, r) => e && isFunction(e.fetch) ? e.fetch(t, r) : fetch(t, r))(e, s);
|
2179 | if (o) {
|
2180 | if (o.ok) {
|
2181 | const i = await o.clone().text();
|
2182 | return await (async (e, t, r, s, n, o) => {
|
2183 | r.endsWith("package.json") && ((e, t) => {
|
2184 | try {
|
2185 | const r = JSON.parse(t);
|
2186 | r.name && r.version && ((e, t, r) => {
|
2187 | e.set(t, r);
|
2188 | })(e, r.name, r.version);
|
2189 | } catch (e) {}
|
2190 | })(o, n);
|
2191 | let i = path$2.dirname(s);
|
2192 | for (;"/" !== i && "" !== i; ) t ? (t.clearFileCache(i), await t.sys.createDir(i)) : await e.createDir(i),
|
2193 | i = path$2.dirname(i);
|
2194 | t ? (t.clearFileCache(s), await t.sys.writeFile(s, n)) : await e.writeFile(s, n);
|
2195 | })(e, t, s, n, i, r), i;
|
2196 | }
|
2197 | 404 === o.status && known404Urls.add(s);
|
2198 | }
|
2199 | } catch (e) {
|
2200 | console.error(e);
|
2201 | }
|
2202 | };
|
2203 |
|
2204 | caller = function() {
|
2205 | var e, t = Error.prepareStackTrace;
|
2206 | return Error.prepareStackTrace = function(e, t) {
|
2207 | return t;
|
2208 | }, e = (new Error).stack, Error.prepareStackTrace = t, e[2].getFileName();
|
2209 | }, pathParse = function createCommonjsModule(e, t, r) {
|
2210 | return e(r = {
|
2211 | path: t,
|
2212 | exports: {},
|
2213 | require: function(e, t) {
|
2214 | return function s() {
|
2215 | throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
|
2216 | }(null == t && r.path);
|
2217 | }
|
2218 | }, r.exports), r.exports;
|
2219 | }((function(e) {
|
2220 | var t, r, s = "win32" === process.platform, n = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/, o = {
|
2221 | parse: function(e) {
|
2222 | if ("string" != typeof e) throw new TypeError("Parameter 'pathString' must be a string, not " + typeof e);
|
2223 | var t = function r(e) {
|
2224 | return n.exec(e).slice(1);
|
2225 | }(e);
|
2226 | if (!t || 5 !== t.length) throw new TypeError("Invalid path '" + e + "'");
|
2227 | return {
|
2228 | root: t[1],
|
2229 | dir: t[0] === t[1] ? t[0] : t[0].slice(0, -1),
|
2230 | base: t[2],
|
2231 | ext: t[4],
|
2232 | name: t[3]
|
2233 | };
|
2234 | }
|
2235 | };
|
2236 | t = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/, (r = {}).parse = function(e) {
|
2237 | if ("string" != typeof e) throw new TypeError("Parameter 'pathString' must be a string, not " + typeof e);
|
2238 | var r = function s(e) {
|
2239 | return t.exec(e).slice(1);
|
2240 | }(e);
|
2241 | if (!r || 5 !== r.length) throw new TypeError("Invalid path '" + e + "'");
|
2242 | return {
|
2243 | root: r[1],
|
2244 | dir: r[0].slice(0, -1),
|
2245 | base: r[2],
|
2246 | ext: r[4],
|
2247 | name: r[3]
|
2248 | };
|
2249 | }, e.exports = s ? o.parse : r.parse, e.exports.posix = r.parse, e.exports.win32 = o.parse;
|
2250 | })), parse = path__default.default.parse || pathParse, getNodeModulesDirs = function e(t, r) {
|
2251 | var s, n, o = "/";
|
2252 | for (/^([A-Za-z]:)/.test(t) ? o = "" : /^\\\\/.test(t) && (o = "\\\\"), s = [ t ],
|
2253 | n = parse(t); n.dir !== s[s.length - 1]; ) s.push(n.dir), n = parse(n.dir);
|
2254 | return s.reduce((function(e, t) {
|
2255 | return e.concat(r.map((function(e) {
|
2256 | return path__default.default.resolve(o, t, e);
|
2257 | })));
|
2258 | }), []);
|
2259 | }, nodeModulesPaths = function e(t, r, s) {
|
2260 | var n, o = r && r.moduleDirectory ? [].concat(r.moduleDirectory) : [ "node_modules" ];
|
2261 | return r && "function" == typeof r.paths ? r.paths(s, t, (function() {
|
2262 | return getNodeModulesDirs(t, o);
|
2263 | }), r) : (n = getNodeModulesDirs(t, o), r && r.paths ? n.concat(r.paths) : n);
|
2264 | }, normalizeOptions = function(e, t) {
|
2265 | return t || {};
|
2266 | }, ERROR_MESSAGE = "Function.prototype.bind called on incompatible ", slice = Array.prototype.slice,
|
2267 | toStr = Object.prototype.toString, implementation = function e(t) {
|
2268 | var r, s, n, o, i, a, l, c = this;
|
2269 | if ("function" != typeof c || "[object Function]" !== toStr.call(c)) throw new TypeError(ERROR_MESSAGE + c);
|
2270 | for (r = slice.call(arguments, 1), n = function() {
|
2271 | if (this instanceof s) {
|
2272 | var e = c.apply(this, r.concat(slice.call(arguments)));
|
2273 | return Object(e) === e ? e : this;
|
2274 | }
|
2275 | return c.apply(t, r.concat(slice.call(arguments)));
|
2276 | }, o = Math.max(0, c.length - r.length), i = [], a = 0; a < o; a++) i.push("$" + a);
|
2277 | return s = Function("binder", "return function (" + i.join(",") + "){ return binder.apply(this,arguments); }")(n),
|
2278 | c.prototype && ((l = function e() {}).prototype = c.prototype, s.prototype = new l,
|
2279 | l.prototype = null), s;
|
2280 | }, functionBind = Function.prototype.bind || implementation, src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
|
2281 |
|
2282 | const data$1 = {
|
2283 | assert: !0,
|
2284 | "assert/strict": ">= 15",
|
2285 | async_hooks: ">= 8",
|
2286 | buffer_ieee754: "< 0.9.7",
|
2287 | buffer: !0,
|
2288 | child_process: !0,
|
2289 | cluster: !0,
|
2290 | console: !0,
|
2291 | constants: !0,
|
2292 | crypto: !0,
|
2293 | _debug_agent: ">= 1 && < 8",
|
2294 | _debugger: "< 8",
|
2295 | dgram: !0,
|
2296 | diagnostics_channel: ">= 15.1",
|
2297 | dns: !0,
|
2298 | "dns/promises": ">= 15",
|
2299 | domain: ">= 0.7.12",
|
2300 | events: !0,
|
2301 | freelist: "< 6",
|
2302 | fs: !0,
|
2303 | "fs/promises": [ ">= 10 && < 10.1", ">= 14" ],
|
2304 | _http_agent: ">= 0.11.1",
|
2305 | _http_client: ">= 0.11.1",
|
2306 | _http_common: ">= 0.11.1",
|
2307 | _http_incoming: ">= 0.11.1",
|
2308 | _http_outgoing: ">= 0.11.1",
|
2309 | _http_server: ">= 0.11.1",
|
2310 | http: !0,
|
2311 | http2: ">= 8.8",
|
2312 | https: !0,
|
2313 | inspector: ">= 8.0.0",
|
2314 | _linklist: "< 8",
|
2315 | module: !0,
|
2316 | net: !0,
|
2317 | "node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
|
2318 | "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
|
2319 | "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
|
2320 | os: !0,
|
2321 | path: !0,
|
2322 | "path/posix": ">= 15.3",
|
2323 | "path/win32": ">= 15.3",
|
2324 | perf_hooks: ">= 8.5",
|
2325 | process: ">= 1",
|
2326 | punycode: !0,
|
2327 | querystring: !0,
|
2328 | readline: !0,
|
2329 | repl: !0,
|
2330 | smalloc: ">= 0.11.5 && < 3",
|
2331 | _stream_duplex: ">= 0.9.4",
|
2332 | _stream_transform: ">= 0.9.4",
|
2333 | _stream_wrap: ">= 1.4.1",
|
2334 | _stream_passthrough: ">= 0.9.4",
|
2335 | _stream_readable: ">= 0.9.4",
|
2336 | _stream_writable: ">= 0.9.4",
|
2337 | stream: !0,
|
2338 | "stream/promises": ">= 15",
|
2339 | string_decoder: !0,
|
2340 | sys: [ ">= 0.6 && < 0.7", ">= 0.8" ],
|
2341 | timers: !0,
|
2342 | "timers/promises": ">= 15",
|
2343 | _tls_common: ">= 0.11.13",
|
2344 | _tls_legacy: ">= 0.11.3 && < 10",
|
2345 | _tls_wrap: ">= 0.11.3",
|
2346 | tls: !0,
|
2347 | trace_events: ">= 10",
|
2348 | tty: !0,
|
2349 | url: !0,
|
2350 | util: !0,
|
2351 | "util/types": ">= 15.3",
|
2352 | "v8/tools/arguments": ">= 10 && < 12",
|
2353 | "v8/tools/codemap": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2354 | "v8/tools/consarray": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2355 | "v8/tools/csvparser": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2356 | "v8/tools/logreader": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2357 | "v8/tools/profile_view": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2358 | "v8/tools/splaytree": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2359 | v8: ">= 1",
|
2360 | vm: !0,
|
2361 | wasi: ">= 13.4 && < 13.5",
|
2362 | worker_threads: ">= 11.7",
|
2363 | zlib: !0
|
2364 | };
|
2365 |
|
2366 | isCoreModule = function e(t, r) {
|
2367 | return src(data$1, t) && function s(e, t) {
|
2368 | var r, s;
|
2369 | if ("boolean" == typeof t) return t;
|
2370 | if ("string" != typeof (r = void 0 === e ? process.versions && process.versions.node && process.versions.node : e)) throw new TypeError(void 0 === e ? "Unable to determine current node version" : "If provided, a valid node version is required");
|
2371 | if (t && "object" == typeof t) {
|
2372 | for (s = 0; s < t.length; ++s) if (matchesRange$1(r, t[s])) return !0;
|
2373 | return !1;
|
2374 | }
|
2375 | return matchesRange$1(r, t);
|
2376 | }(r, data$1[t]);
|
2377 | }, realpathFS$1 = fs__default.default.realpath && "function" == typeof fs__default.default.realpath.native ? fs__default.default.realpath.native : fs__default.default.realpath,
|
2378 | defaultIsFile$1 = function e(t, r) {
|
2379 | fs__default.default.stat(t, (function(e, t) {
|
2380 | return e ? "ENOENT" === e.code || "ENOTDIR" === e.code ? r(null, !1) : r(e) : r(null, t.isFile() || t.isFIFO());
|
2381 | }));
|
2382 | }, defaultIsDir$1 = function e(t, r) {
|
2383 | fs__default.default.stat(t, (function(e, t) {
|
2384 | return e ? "ENOENT" === e.code || "ENOTDIR" === e.code ? r(null, !1) : r(e) : r(null, t.isDirectory());
|
2385 | }));
|
2386 | }, defaultRealpath = function e(t, r) {
|
2387 | realpathFS$1(t, (function(e, s) {
|
2388 | e && "ENOENT" !== e.code ? r(e) : r(null, e ? t : s);
|
2389 | }));
|
2390 | }, maybeRealpath = function e(t, r, s, n) {
|
2391 | s && !1 === s.preserveSymlinks ? t(r, n) : n(null, r);
|
2392 | }, defaultReadPackage = function e(t, r, s) {
|
2393 | t(r, (function(e, t) {
|
2394 | if (e) s(e); else try {
|
2395 | var r = JSON.parse(t);
|
2396 | s(null, r);
|
2397 | } catch (e) {
|
2398 | s(null);
|
2399 | }
|
2400 | }));
|
2401 | }, getPackageCandidates$1 = function e(t, r, s) {
|
2402 | var n, o = nodeModulesPaths(r, s, t);
|
2403 | for (n = 0; n < o.length; n++) o[n] = path__default.default.join(o[n], t);
|
2404 | return o;
|
2405 | }, async = function e(t, r, s) {
|
2406 | function n(e) {
|
2407 | if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(t)) T = path__default.default.resolve(e, t),
|
2408 | "." !== t && ".." !== t && "/" !== t.slice(-1) || (T += "/"), /\/$/.test(t) && T === e ? l(T, C.package, o) : i(T, C.package, o); else {
|
2409 | if (_ && isCoreModule(t)) return S(null, t);
|
2410 | !function r(e, t, s) {
|
2411 | var n = function() {
|
2412 | return getPackageCandidates$1(e, t, C);
|
2413 | };
|
2414 | c(s, y ? y(e, t, n, C) : n());
|
2415 | }(t, e, (function(e, r, s) {
|
2416 | if (e) S(e); else {
|
2417 | if (r) return maybeRealpath(f, r, C, (function(e, t) {
|
2418 | e ? S(e) : S(null, t, s);
|
2419 | }));
|
2420 | var n = new Error("Cannot find module '" + t + "' from '" + b + "'");
|
2421 | n.code = "MODULE_NOT_FOUND", S(n);
|
2422 | }
|
2423 | }));
|
2424 | }
|
2425 | }
|
2426 | function o(e, r, s) {
|
2427 | e ? S(e) : r ? S(null, r, s) : l(T, (function(e, r, s) {
|
2428 | if (e) S(e); else if (r) maybeRealpath(f, r, C, (function(e, t) {
|
2429 | e ? S(e) : S(null, t, s);
|
2430 | })); else {
|
2431 | var n = new Error("Cannot find module '" + t + "' from '" + b + "'");
|
2432 | n.code = "MODULE_NOT_FOUND", S(n);
|
2433 | }
|
2434 | }));
|
2435 | }
|
2436 | function i(e, t, r) {
|
2437 | var s = t, n = r;
|
2438 | "function" == typeof s && (n = s, s = void 0), function e(t, r, s) {
|
2439 | function o(s, o, a) {
|
2440 | var u, h, p;
|
2441 | return c = o, s ? n(s) : a && c && C.pathFilter && (h = (u = path__default.default.relative(a, l)).slice(0, u.length - t[0].length),
|
2442 | p = C.pathFilter(c, r, h)) ? e([ "" ].concat(w.slice()), path__default.default.resolve(a, p), c) : void d(l, i);
|
2443 | }
|
2444 | function i(s, o) {
|
2445 | return s ? n(s) : o ? n(null, l, c) : void e(t.slice(1), r, c);
|
2446 | }
|
2447 | var l, c;
|
2448 | if (0 === t.length) return n(null, void 0, s);
|
2449 | l = r + t[0], (c = s) ? o(null, c) : a(path__default.default.dirname(l), o);
|
2450 | }([ "" ].concat(w), e, s);
|
2451 | }
|
2452 | function a(e, t) {
|
2453 | return "" === e || "/" === e || "win32" === process.platform && /^\w:[/\\]*$/.test(e) || /[/\\]node_modules[/\\]*$/.test(e) ? t(null) : void maybeRealpath(f, e, C, (function(r, s) {
|
2454 | if (r) return a(path__default.default.dirname(e), t);
|
2455 | var n = path__default.default.join(s, "package.json");
|
2456 | d(n, (function(r, s) {
|
2457 | if (!s) return a(path__default.default.dirname(e), t);
|
2458 | m(p, n, (function(r, s) {
|
2459 | r && t(r);
|
2460 | var o = s;
|
2461 | o && C.packageFilter && (o = C.packageFilter(o, n)), t(null, o, e);
|
2462 | }));
|
2463 | }));
|
2464 | }));
|
2465 | }
|
2466 | function l(e, t, r) {
|
2467 | var s = r, n = t;
|
2468 | "function" == typeof n && (s = n, n = C.package), maybeRealpath(f, e, C, (function(t, r) {
|
2469 | if (t) return s(t);
|
2470 | var o = path__default.default.join(r, "package.json");
|
2471 | d(o, (function(t, r) {
|
2472 | return t ? s(t) : r ? void m(p, o, (function(t, r) {
|
2473 | var n, a;
|
2474 | return t ? s(t) : ((n = r) && C.packageFilter && (n = C.packageFilter(n, o)), n && n.main ? "string" != typeof n.main ? ((a = new TypeError("package “" + n.name + "” `main` must be a string")).code = "INVALID_PACKAGE_MAIN",
|
2475 | s(a)) : ("." !== n.main && "./" !== n.main || (n.main = "index"), void i(path__default.default.resolve(e, n.main), n, (function(t, r, n) {
|
2476 | return t ? s(t) : r ? s(null, r, n) : n ? void l(path__default.default.resolve(e, n.main), n, (function(t, r, n) {
|
2477 | return t ? s(t) : r ? s(null, r, n) : void i(path__default.default.join(e, "index"), n, s);
|
2478 | })) : i(path__default.default.join(e, "index"), n, s);
|
2479 | }))) : void i(path__default.default.join(e, "/index"), n, s));
|
2480 | })) : i(path__default.default.join(e, "index"), n, s);
|
2481 | }));
|
2482 | }));
|
2483 | }
|
2484 | function c(e, t) {
|
2485 | function r(t, r, o) {
|
2486 | return t ? e(t) : r ? e(null, r, o) : void l(n, C.package, s);
|
2487 | }
|
2488 | function s(r, s, n) {
|
2489 | return r ? e(r) : s ? e(null, s, n) : void c(e, t.slice(1));
|
2490 | }
|
2491 | if (0 === t.length) return e(null, void 0);
|
2492 | var n = t[0];
|
2493 | h(path__default.default.dirname(n), (function o(s, a) {
|
2494 | return s ? e(s) : a ? void i(n, C.package, r) : c(e, t.slice(1));
|
2495 | }));
|
2496 | }
|
2497 | var u, d, h, p, f, m, g, y, w, _, v, b, E, T, S = s, C = r;
|
2498 | return "function" == typeof r && (S = C, C = {}), "string" != typeof t ? (u = new TypeError("Path must be a string."),
|
2499 | process.nextTick((function() {
|
2500 | S(u);
|
2501 | }))) : (C = normalizeOptions(0, C), d = C.isFile || defaultIsFile$1, h = C.isDirectory || defaultIsDir$1,
|
2502 | p = C.readFile || fs__default.default.readFile, f = C.realpath || defaultRealpath,
|
2503 | m = C.readPackage || defaultReadPackage, C.readFile && C.readPackage ? (g = new TypeError("`readFile` and `readPackage` are mutually exclusive."),
|
2504 | process.nextTick((function() {
|
2505 | S(g);
|
2506 | }))) : (y = C.packageIterator, w = C.extensions || [ ".js" ], _ = !1 !== C.includeCoreModules,
|
2507 | v = C.basedir || path__default.default.dirname(caller()), b = C.filename || v, C.paths = C.paths || [],
|
2508 | E = path__default.default.resolve(v), void maybeRealpath(f, E, C, (function(e, t) {
|
2509 | e ? S(e) : n(t);
|
2510 | }))));
|
2511 | };
|
2512 |
|
2513 | const data = {
|
2514 | assert: !0,
|
2515 | "assert/strict": ">= 15",
|
2516 | async_hooks: ">= 8",
|
2517 | buffer_ieee754: "< 0.9.7",
|
2518 | buffer: !0,
|
2519 | child_process: !0,
|
2520 | cluster: !0,
|
2521 | console: !0,
|
2522 | constants: !0,
|
2523 | crypto: !0,
|
2524 | _debug_agent: ">= 1 && < 8",
|
2525 | _debugger: "< 8",
|
2526 | dgram: !0,
|
2527 | diagnostics_channel: ">= 15.1",
|
2528 | dns: !0,
|
2529 | "dns/promises": ">= 15",
|
2530 | domain: ">= 0.7.12",
|
2531 | events: !0,
|
2532 | freelist: "< 6",
|
2533 | fs: !0,
|
2534 | "fs/promises": [ ">= 10 && < 10.1", ">= 14" ],
|
2535 | _http_agent: ">= 0.11.1",
|
2536 | _http_client: ">= 0.11.1",
|
2537 | _http_common: ">= 0.11.1",
|
2538 | _http_incoming: ">= 0.11.1",
|
2539 | _http_outgoing: ">= 0.11.1",
|
2540 | _http_server: ">= 0.11.1",
|
2541 | http: !0,
|
2542 | http2: ">= 8.8",
|
2543 | https: !0,
|
2544 | inspector: ">= 8.0.0",
|
2545 | _linklist: "< 8",
|
2546 | module: !0,
|
2547 | net: !0,
|
2548 | "node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
|
2549 | "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
|
2550 | "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
|
2551 | os: !0,
|
2552 | path: !0,
|
2553 | "path/posix": ">= 15.3",
|
2554 | "path/win32": ">= 15.3",
|
2555 | perf_hooks: ">= 8.5",
|
2556 | process: ">= 1",
|
2557 | punycode: !0,
|
2558 | querystring: !0,
|
2559 | readline: !0,
|
2560 | repl: !0,
|
2561 | smalloc: ">= 0.11.5 && < 3",
|
2562 | _stream_duplex: ">= 0.9.4",
|
2563 | _stream_transform: ">= 0.9.4",
|
2564 | _stream_wrap: ">= 1.4.1",
|
2565 | _stream_passthrough: ">= 0.9.4",
|
2566 | _stream_readable: ">= 0.9.4",
|
2567 | _stream_writable: ">= 0.9.4",
|
2568 | stream: !0,
|
2569 | "stream/promises": ">= 15",
|
2570 | string_decoder: !0,
|
2571 | sys: [ ">= 0.6 && < 0.7", ">= 0.8" ],
|
2572 | timers: !0,
|
2573 | "timers/promises": ">= 15",
|
2574 | _tls_common: ">= 0.11.13",
|
2575 | _tls_legacy: ">= 0.11.3 && < 10",
|
2576 | _tls_wrap: ">= 0.11.3",
|
2577 | tls: !0,
|
2578 | trace_events: ">= 10",
|
2579 | tty: !0,
|
2580 | url: !0,
|
2581 | util: !0,
|
2582 | "util/types": ">= 15.3",
|
2583 | "v8/tools/arguments": ">= 10 && < 12",
|
2584 | "v8/tools/codemap": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2585 | "v8/tools/consarray": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2586 | "v8/tools/csvparser": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2587 | "v8/tools/logreader": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2588 | "v8/tools/profile_view": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2589 | "v8/tools/splaytree": [ ">= 4.4.0 && < 5", ">= 5.2.0 && < 12" ],
|
2590 | v8: ">= 1",
|
2591 | vm: !0,
|
2592 | wasi: ">= 13.4 && < 13.5",
|
2593 | worker_threads: ">= 11.7",
|
2594 | zlib: !0
|
2595 | };
|
2596 |
|
2597 | for (mod in current = process.versions && process.versions.node && process.versions.node.split(".") || [],
|
2598 | core = {}, data) Object.prototype.hasOwnProperty.call(data, mod) && (core[mod] = versionIncluded(data[mod]));
|
2599 |
|
2600 | core_1 = core, isCore = function e(t) {
|
2601 | return isCoreModule(t);
|
2602 | }, realpathFS = fs__default.default.realpathSync && "function" == typeof fs__default.default.realpathSync.native ? fs__default.default.realpathSync.native : fs__default.default.realpathSync,
|
2603 | defaultIsFile = function e(t) {
|
2604 | try {
|
2605 | var r = fs__default.default.statSync(t);
|
2606 | } catch (e) {
|
2607 | if (e && ("ENOENT" === e.code || "ENOTDIR" === e.code)) return !1;
|
2608 | throw e;
|
2609 | }
|
2610 | return r.isFile() || r.isFIFO();
|
2611 | }, defaultIsDir = function e(t) {
|
2612 | try {
|
2613 | var r = fs__default.default.statSync(t);
|
2614 | } catch (e) {
|
2615 | if (e && ("ENOENT" === e.code || "ENOTDIR" === e.code)) return !1;
|
2616 | throw e;
|
2617 | }
|
2618 | return r.isDirectory();
|
2619 | }, defaultRealpathSync = function e(t) {
|
2620 | try {
|
2621 | return realpathFS(t);
|
2622 | } catch (e) {
|
2623 | if ("ENOENT" !== e.code) throw e;
|
2624 | }
|
2625 | return t;
|
2626 | }, maybeRealpathSync = function e(t, r, s) {
|
2627 | return s && !1 === s.preserveSymlinks ? t(r) : r;
|
2628 | }, defaultReadPackageSync = function e(t, r) {
|
2629 | var s = t(r);
|
2630 | try {
|
2631 | return JSON.parse(s);
|
2632 | } catch (e) {}
|
2633 | }, getPackageCandidates = function e(t, r, s) {
|
2634 | var n, o = nodeModulesPaths(r, s, t);
|
2635 | for (n = 0; n < o.length; n++) o[n] = path__default.default.join(o[n], t);
|
2636 | return o;
|
2637 | }, sync = function e(t, r) {
|
2638 | function s(e) {
|
2639 | var t, r, s, o, l = n(path__default.default.dirname(e));
|
2640 | if (l && l.dir && l.pkg && i.pathFilter && (t = path__default.default.relative(l.dir, e),
|
2641 | (r = i.pathFilter(l.pkg, e, t)) && (e = path__default.default.resolve(l.dir, r))),
|
2642 | a(e)) return e;
|
2643 | for (s = 0; s < p.length; s++) if (o = e + p[s], a(o)) return o;
|
2644 | }
|
2645 | function n(e) {
|
2646 | var t, r;
|
2647 | if ("" !== e && "/" !== e && !("win32" === process.platform && /^\w:[/\\]*$/.test(e) || /[/\\]node_modules[/\\]*$/.test(e))) return t = path__default.default.join(maybeRealpathSync(u, e, i), "package.json"),
|
2648 | a(t) ? ((r = d(l, t)) && i.packageFilter && (r = i.packageFilter(r, e)), {
|
2649 | pkg: r,
|
2650 | dir: e
|
2651 | }) : n(path__default.default.dirname(e));
|
2652 | }
|
2653 | function o(e) {
|
2654 | var t, r, n, c, h = path__default.default.join(maybeRealpathSync(u, e, i), "/package.json");
|
2655 | if (a(h)) {
|
2656 | try {
|
2657 | t = d(l, h);
|
2658 | } catch (e) {}
|
2659 | if (t && i.packageFilter && (t = i.packageFilter(t, e)), t && t.main) {
|
2660 | if ("string" != typeof t.main) throw (r = new TypeError("package “" + t.name + "” `main` must be a string")).code = "INVALID_PACKAGE_MAIN",
|
2661 | r;
|
2662 | "." !== t.main && "./" !== t.main || (t.main = "index");
|
2663 | try {
|
2664 | if (n = s(path__default.default.resolve(e, t.main))) return n;
|
2665 | if (c = o(path__default.default.resolve(e, t.main))) return c;
|
2666 | } catch (e) {}
|
2667 | }
|
2668 | }
|
2669 | return s(path__default.default.join(e, "/index"));
|
2670 | }
|
2671 | var i, a, l, c, u, d, h, p, f, m, g, y, w, _, v, b;
|
2672 | if ("string" != typeof t) throw new TypeError("Path must be a string.");
|
2673 | if (i = normalizeOptions(0, r), a = i.isFile || defaultIsFile, l = i.readFileSync || fs__default.default.readFileSync,
|
2674 | c = i.isDirectory || defaultIsDir, u = i.realpathSync || defaultRealpathSync, d = i.readPackageSync || defaultReadPackageSync,
|
2675 | i.readFileSync && i.readPackageSync) throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
|
2676 | if (h = i.packageIterator, p = i.extensions || [ ".js" ], f = !1 !== i.includeCoreModules,
|
2677 | m = i.basedir || path__default.default.dirname(caller()), g = i.filename || m, i.paths = i.paths || [],
|
2678 | y = maybeRealpathSync(u, path__default.default.resolve(m), i), /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(t)) {
|
2679 | if (w = path__default.default.resolve(y, t), "." !== t && ".." !== t && "/" !== t.slice(-1) || (w += "/"),
|
2680 | _ = s(w) || o(w)) return maybeRealpathSync(u, _, i);
|
2681 | } else {
|
2682 | if (f && isCoreModule(t)) return t;
|
2683 | if (v = function E(e, t) {
|
2684 | var r, n, a, l, u = function() {
|
2685 | return getPackageCandidates(e, t, i);
|
2686 | }, d = h ? h(e, t, u, i) : u();
|
2687 | for (r = 0; r < d.length; r++) if (n = d[r], c(path__default.default.dirname(n))) {
|
2688 | if (a = s(n)) return a;
|
2689 | if (l = o(n)) return l;
|
2690 | }
|
2691 | }(t, y)) return maybeRealpathSync(u, v, i);
|
2692 | }
|
2693 | throw (b = new Error("Cannot find module '" + t + "' from '" + g + "'")).code = "MODULE_NOT_FOUND",
|
2694 | b;
|
2695 | }, async.core = core_1, async.isCore = isCore, async.sync = sync, resolve = async;
|
2696 |
|
2697 | const createSystem = e => {
|
2698 | const t = e && e.logger ? e.logger : (() => {
|
2699 | let e = IS_BROWSER_ENV, t = "info";
|
2700 | return {
|
2701 | enableColors: t => e = t,
|
2702 | getLevel: () => t,
|
2703 | setLevel: e => t = e,
|
2704 | emoji: e => e,
|
2705 | info: console.log.bind(console),
|
2706 | warn: console.warn.bind(console),
|
2707 | error: console.error.bind(console),
|
2708 | debug: console.debug.bind(console),
|
2709 | red: e => e,
|
2710 | green: e => e,
|
2711 | yellow: e => e,
|
2712 | blue: e => e,
|
2713 | magenta: e => e,
|
2714 | cyan: e => e,
|
2715 | gray: e => e,
|
2716 | bold: e => e,
|
2717 | dim: e => e,
|
2718 | bgRed: e => e,
|
2719 | createTimeSpan: (e, t = !1) => ({
|
2720 | duration: () => 0,
|
2721 | finish: () => 0
|
2722 | }),
|
2723 | printDiagnostics(t) {
|
2724 | t.forEach((t => ((e, t) => {
|
2725 | let r = BLUE, s = "Build", n = "";
|
2726 | "error" === e.level ? (r = RED, s = "Error") : "warn" === e.level && (r = YELLOW,
|
2727 | s = "Warning"), e.header && (s = e.header);
|
2728 | const o = e.relFilePath || e.absFilePath;
|
2729 | if (o && (n += o, "number" == typeof e.lineNumber && e.lineNumber > 0 && (n += ", line " + e.lineNumber,
|
2730 | "number" == typeof e.columnNumber && e.columnNumber > 0 && (n += ", column " + e.columnNumber)),
|
2731 | n += "\n"), n += e.messageText, e.lines && e.lines.length > 0 && (e.lines.forEach((e => {
|
2732 | n += "\n" + e.lineNumber + ": " + e.text;
|
2733 | })), n += "\n"), t) {
|
2734 | const e = [ "%c" + s, `background: ${r}; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` ];
|
2735 | console.log(...e, n);
|
2736 | } else "error" === e.level ? console.error(n) : "warn" === e.level ? console.warn(n) : console.log(n);
|
2737 | })(t, e)));
|
2738 | }
|
2739 | };
|
2740 | })(), r = new Map, s = new Set, n = e => s.add(e), o = e => s.delete(e), i = buildEvents(), a = IS_BROWSER_ENV && navigator.hardwareConcurrency || 1, l = e => {
|
2741 | if ("/" === e || "" === e) return "/";
|
2742 | const t = path$2.dirname(e), r = path$2.basename(e);
|
2743 | return t.endsWith("/") ? normalizePath(`${t}${r}`) : normalizePath(`${t}/${r}`);
|
2744 | }, c = e => {
|
2745 | const t = r.get(l(e));
|
2746 | return !(!t || !(t.isDirectory || t.isFile && "string" == typeof t.data));
|
2747 | }, u = (e, t) => {
|
2748 | e = l(e);
|
2749 | const r = {
|
2750 | basename: path$2.basename(e),
|
2751 | dirname: path$2.dirname(e),
|
2752 | path: e,
|
2753 | newDirs: [],
|
2754 | error: null
|
2755 | };
|
2756 | return d(e, t, r), r;
|
2757 | }, d = (e, t, s) => {
|
2758 | const n = path$2.dirname(e);
|
2759 | t && t.recursive && !(e => "/" === e || windowsPathRegex.test(e))(n) && d(n, t, s);
|
2760 | const o = r.get(e);
|
2761 | o ? (o.isDirectory = !0, o.isFile = !1) : (r.set(e, {
|
2762 | basename: path$2.basename(e),
|
2763 | dirname: n,
|
2764 | isDirectory: !0,
|
2765 | isFile: !1,
|
2766 | watcherCallbacks: null,
|
2767 | data: void 0
|
2768 | }), s.newDirs.push(e), v(e, new Set));
|
2769 | }, h = e => {
|
2770 | e = l(e);
|
2771 | const t = [], s = r.get(e);
|
2772 | return s && s.isDirectory && r.forEach(((r, s) => {
|
2773 | "/" !== s && (r.isDirectory || r.isFile && "string" == typeof r.data) && (e.endsWith("/") && `${e}${r.basename}` === s || `${e}/${r.basename}` === s) && t.push(s);
|
2774 | })), t.sort();
|
2775 | }, p = e => {
|
2776 | e = l(e);
|
2777 | const t = r.get(e);
|
2778 | if (t && t.isFile) return t.data;
|
2779 | }, f = e => ({
|
2780 | path: l(e),
|
2781 | error: null
|
2782 | }), m = (e, t, s) => {
|
2783 | const n = w(e);
|
2784 | if (!n.error && !s.error) if (n.isFile) {
|
2785 | const n = path$2.dirname(t), o = u(n, {
|
2786 | recursive: !0
|
2787 | }), i = r.get(e).data, a = b(t, i);
|
2788 | s.newDirs.push(...o.newDirs), s.renamed.push({
|
2789 | oldPath: e,
|
2790 | newPath: t,
|
2791 | isDirectory: !1,
|
2792 | isFile: !0
|
2793 | }), a.error ? s.error = a.error : s.newFiles.push(t);
|
2794 | } else if (n.isDirectory) {
|
2795 | const r = h(e), n = u(t, {
|
2796 | recursive: !0
|
2797 | });
|
2798 | s.newDirs.push(...n.newDirs), s.renamed.push({
|
2799 | oldPath: e,
|
2800 | newPath: t,
|
2801 | isDirectory: !0,
|
2802 | isFile: !1
|
2803 | });
|
2804 | for (const n of r) {
|
2805 | const r = n.replace(e, t);
|
2806 | m(n, r, s);
|
2807 | }
|
2808 | }
|
2809 | }, g = (e, t = {}) => {
|
2810 | const r = {
|
2811 | basename: path$2.basename(e),
|
2812 | dirname: path$2.dirname(e),
|
2813 | path: e,
|
2814 | removedDirs: [],
|
2815 | removedFiles: [],
|
2816 | error: null
|
2817 | };
|
2818 | return y(e, t, r), r;
|
2819 | }, y = (e, t, s) => {
|
2820 | if (!s.error) {
|
2821 | e = l(e);
|
2822 | const n = h(e);
|
2823 | if (t && t.recursive) for (const e of n) {
|
2824 | const n = r.get(e);
|
2825 | if (n) if (n.isDirectory) y(e, t, s); else if (n.isFile) {
|
2826 | const t = _(e);
|
2827 | t.error ? s.error = t.error : s.removedFiles.push(e);
|
2828 | }
|
2829 | } else if (n.length > 0) return void (s.error = "cannot delete directory that contains files/subdirectories");
|
2830 | r.delete(e), v(e, new Set), s.removedDirs.push(e);
|
2831 | }
|
2832 | }, w = e => {
|
2833 | e = l(e);
|
2834 | const t = r.get(e);
|
2835 | return t && (t.isDirectory || t.isFile && "string" == typeof t.data) ? {
|
2836 | isDirectory: t.isDirectory,
|
2837 | isFile: t.isFile,
|
2838 | isSymbolicLink: !1,
|
2839 | size: t.isFile && t.data ? t.data.length : 0,
|
2840 | error: null
|
2841 | } : {
|
2842 | isDirectory: !1,
|
2843 | isFile: !1,
|
2844 | isSymbolicLink: !1,
|
2845 | size: 0,
|
2846 | error: `ENOENT: no such file or directory, statSync '${e}'`
|
2847 | };
|
2848 | }, _ = e => {
|
2849 | e = l(e);
|
2850 | const t = {
|
2851 | basename: path$2.basename(e),
|
2852 | dirname: path$2.dirname(e),
|
2853 | path: e,
|
2854 | error: null
|
2855 | }, s = r.get(e);
|
2856 | if (s) {
|
2857 | if (s.watcherCallbacks) for (const t of s.watcherCallbacks) t(e, "fileDelete");
|
2858 | r.delete(e), v(e, new Set);
|
2859 | }
|
2860 | return t;
|
2861 | }, v = (e, t) => {
|
2862 | const s = l(path$2.dirname(e)), n = r.get(s);
|
2863 | if (n && n.isDirectory && n.watcherCallbacks) for (const t of n.watcherCallbacks) t(e, null);
|
2864 | t.has(s) || (t.add(s), v(s, t));
|
2865 | }, b = (e, t) => {
|
2866 | const s = {
|
2867 | path: e = l(e),
|
2868 | error: null
|
2869 | }, n = r.get(e);
|
2870 | if (n) {
|
2871 | const r = n.data !== t;
|
2872 | if (n.data = t, r && n.watcherCallbacks) for (const t of n.watcherCallbacks) t(e, "fileUpdate");
|
2873 | } else r.set(e, {
|
2874 | basename: path$2.basename(e),
|
2875 | dirname: path$2.dirname(e),
|
2876 | isDirectory: !1,
|
2877 | isFile: !0,
|
2878 | watcherCallbacks: null,
|
2879 | data: t
|
2880 | }), v(e, new Set);
|
2881 | return s;
|
2882 | }, E = "undefined" != typeof self ? null === self || void 0 === self ? void 0 : self.fetch : "undefined" != typeof window ? null === window || void 0 === window ? void 0 : window.fetch : "undefined" != typeof global ? null === global || void 0 === global ? void 0 : global.fetch : void 0, T = Promise.resolve();
|
2883 | u("/");
|
2884 | const S = {
|
2885 | name: "in-memory",
|
2886 | version: "2.18.0",
|
2887 | events: i,
|
2888 | access: async e => c(e),
|
2889 | accessSync: c,
|
2890 | addDestory: n,
|
2891 | copyFile: async (e, t) => (b(t, p(e)), !0),
|
2892 | createDir: async (e, t) => u(e, t),
|
2893 | createDirSync: u,
|
2894 | homeDir: () => os__namespace.homedir(),
|
2895 | isTTY: () => {
|
2896 | var e;
|
2897 | return !!(null === (e = null == process__namespace ? void 0 : process__namespace.stdout) || void 0 === e ? void 0 : e.isTTY);
|
2898 | },
|
2899 | getEnvironmentVar: e => null == process__namespace ? void 0 : process__namespace.env[e],
|
2900 | destroy: async () => {
|
2901 | const e = [];
|
2902 | s.forEach((r => {
|
2903 | try {
|
2904 | const t = r();
|
2905 | t && t.then && e.push(t);
|
2906 | } catch (e) {
|
2907 | t.error(`stencil sys destroy: ${e}`);
|
2908 | }
|
2909 | })), await Promise.all(e), s.clear();
|
2910 | },
|
2911 | encodeToBase64: e => btoa(unescape(encodeURIComponent(e))),
|
2912 | exit: async e => t.warn(`exit ${e}`),
|
2913 | getCurrentDirectory: () => "/",
|
2914 | getCompilerExecutingPath: () => IS_WEB_WORKER_ENV ? location.href : S.getRemoteModuleUrl({
|
2915 | moduleId: "@stencil/core",
|
2916 | path: "compiler/stencil.min.js"
|
2917 | }),
|
2918 | getLocalModulePath: e => path$2.join(e.rootDir, "node_modules", e.moduleId, e.path),
|
2919 | getRemoteModuleUrl: e => {
|
2920 | const t = `${e.moduleId}${e.version ? "@" + e.version : ""}/${e.path}`;
|
2921 | return new URL(t, "https://cdn.jsdelivr.net/npm/").href;
|
2922 | },
|
2923 | hardwareConcurrency: a,
|
2924 | isSymbolicLink: async e => !1,
|
2925 | nextTick: e => T.then(e),
|
2926 | normalizePath: l,
|
2927 | platformPath: pathBrowserify,
|
2928 | readDir: async e => h(e),
|
2929 | readDirSync: h,
|
2930 | readFile: async e => p(e),
|
2931 | readFileSync: p,
|
2932 | realpath: async e => f(e),
|
2933 | realpathSync: f,
|
2934 | removeDestory: o,
|
2935 | rename: async (e, t) => {
|
2936 | const r = {
|
2937 | oldPath: e = normalizePath(e),
|
2938 | newPath: t = normalizePath(t),
|
2939 | renamed: [],
|
2940 | oldDirs: [],
|
2941 | oldFiles: [],
|
2942 | newDirs: [],
|
2943 | newFiles: [],
|
2944 | isFile: !1,
|
2945 | isDirectory: !1,
|
2946 | error: null
|
2947 | }, s = w(e);
|
2948 | if (s.error) r.error = `${e} does not exist`; else if (s.isFile ? r.isFile = !0 : s.isDirectory && (r.isDirectory = !0),
|
2949 | m(e, t, r), !r.error) if (r.isDirectory) {
|
2950 | const t = g(e, {
|
2951 | recursive: !0
|
2952 | });
|
2953 | t.error ? r.error = t.error : (r.oldDirs.push(...t.removedDirs), r.oldFiles.push(...t.removedFiles));
|
2954 | } else if (r.isFile) {
|
2955 | const t = _(e);
|
2956 | t.error ? r.error = t.error : r.oldFiles.push(e);
|
2957 | }
|
2958 | return r;
|
2959 | },
|
2960 | fetch: E,
|
2961 | resolvePath: e => l(e),
|
2962 | removeDir: async (e, t = {}) => g(e, t),
|
2963 | removeDirSync: g,
|
2964 | stat: async e => w(e),
|
2965 | statSync: w,
|
2966 | tmpDirSync: () => "/.tmp",
|
2967 | removeFile: async e => _(e),
|
2968 | removeFileSync: _,
|
2969 | watchDirectory: (e, t) => {
|
2970 | e = l(e);
|
2971 | const s = r.get(e), i = () => {
|
2972 | const s = r.get(e);
|
2973 | if (s && s.watcherCallbacks) {
|
2974 | const e = s.watcherCallbacks.indexOf(t);
|
2975 | e > -1 && s.watcherCallbacks.splice(e, 1);
|
2976 | }
|
2977 | };
|
2978 | return n(i), s ? (s.isDirectory = !0, s.isFile = !1, s.watcherCallbacks = s.watcherCallbacks || [],
|
2979 | s.watcherCallbacks.push(t)) : r.set(e, {
|
2980 | basename: path$2.basename(e),
|
2981 | dirname: path$2.dirname(e),
|
2982 | isDirectory: !0,
|
2983 | isFile: !1,
|
2984 | watcherCallbacks: [ t ],
|
2985 | data: void 0
|
2986 | }), {
|
2987 | close() {
|
2988 | o(i), i();
|
2989 | }
|
2990 | };
|
2991 | },
|
2992 | watchFile: (e, t) => {
|
2993 | e = l(e);
|
2994 | const s = r.get(e), i = () => {
|
2995 | const s = r.get(e);
|
2996 | if (s && s.watcherCallbacks) {
|
2997 | const e = s.watcherCallbacks.indexOf(t);
|
2998 | e > -1 && s.watcherCallbacks.splice(e, 1);
|
2999 | }
|
3000 | };
|
3001 | return n(i), s ? (s.isDirectory = !1, s.isFile = !0, s.watcherCallbacks = s.watcherCallbacks || [],
|
3002 | s.watcherCallbacks.push(t)) : r.set(e, {
|
3003 | basename: path$2.basename(e),
|
3004 | dirname: path$2.dirname(e),
|
3005 | isDirectory: !1,
|
3006 | isFile: !0,
|
3007 | watcherCallbacks: [ t ],
|
3008 | data: void 0
|
3009 | }), {
|
3010 | close() {
|
3011 | o(i), i();
|
3012 | }
|
3013 | };
|
3014 | },
|
3015 | watchTimeout: 32,
|
3016 | writeFile: async (e, t) => b(e, t),
|
3017 | writeFileSync: b,
|
3018 | generateContentHash: async (e, t) => {
|
3019 | const r = await crypto.subtle.digest("SHA-256", (new TextEncoder).encode(e));
|
3020 | let s = Array.from(new Uint8Array(r)).map((e => e.toString(16).padStart(2, "0"))).join("");
|
3021 | return "number" == typeof t && (s = s.slice(0, t)), s;
|
3022 | },
|
3023 | createWorkerController: HAS_WEB_WORKER ? e => ((e, t) => {
|
3024 | let r, s = 0, n = !1, o = !1, i = 0;
|
3025 | const a = new Map, l = [], c = [], u = Math.max(Math.min(t, e.hardwareConcurrency), 2) - 1, d = Promise.resolve(), h = e => console.error(e), p = () => {
|
3026 | let t = null;
|
3027 | const s = e.getCompilerExecutingPath(), o = {
|
3028 | name: "stencil.worker." + i++
|
3029 | };
|
3030 | try {
|
3031 | t = new Worker(s, o);
|
3032 | } catch (e) {
|
3033 | null == r && (r = new Blob([ `importScripts('${s}');` ], {
|
3034 | type: "application/javascript"
|
3035 | })), t = new Worker(URL.createObjectURL(r), o);
|
3036 | }
|
3037 | const l = {
|
3038 | worker: t,
|
3039 | activeTasks: 0,
|
3040 | sendQueue: []
|
3041 | };
|
3042 | return t.onerror = h, t.onmessage = e => ((e, t) => {
|
3043 | if (!n) {
|
3044 | const r = t.data;
|
3045 | if (Array.isArray(r)) for (const t of r) if (t) {
|
3046 | const r = a.get(t.stencilId);
|
3047 | r ? (a.delete(t.stencilId), t.stencilRtnError ? r.reject(t.stencilRtnError) : r.resolve(t.stencilRtnValue),
|
3048 | e.activeTasks--, (e.activeTasks < 0 || e.activeTasks > 50) && (e.activeTasks = 0)) : t.stencilRtnError && console.error(t.stencilRtnError);
|
3049 | }
|
3050 | }
|
3051 | })(l, e), l;
|
3052 | }, f = e => {
|
3053 | e.sendQueue.length > 0 && (e.worker.postMessage(e.sendQueue), e.sendQueue.length = 0);
|
3054 | }, m = e => {
|
3055 | let t;
|
3056 | if (c.length > 0) {
|
3057 | if (t = c[0], u > 1) {
|
3058 | for (const e of c) e.activeTasks < t.activeTasks && (t = e);
|
3059 | t.activeTasks > 0 && c.length < u && (t = p(), c.push(t));
|
3060 | }
|
3061 | } else t = p(), c.push(t);
|
3062 | t.activeTasks++, t.sendQueue.push(e);
|
3063 | }, g = () => {
|
3064 | o = !1, l.forEach(m), l.length = 0, c.forEach(f);
|
3065 | }, y = (...e) => new Promise(((t, r) => {
|
3066 | if (n) r("task canceled"); else {
|
3067 | const n = {
|
3068 | stencilId: s++,
|
3069 | args: e
|
3070 | };
|
3071 | l.push(n), a.set(n.stencilId, {
|
3072 | resolve: t,
|
3073 | reject: r
|
3074 | }), o || (o = !0, d.then(g));
|
3075 | }
|
3076 | }));
|
3077 | return {
|
3078 | send: y,
|
3079 | destroy: () => {
|
3080 | n = !0, a.forEach((e => e.reject("task canceled"))), a.clear(), c.forEach((e => e.worker.terminate())),
|
3081 | c.length = 0;
|
3082 | },
|
3083 | handler: e => function(...t) {
|
3084 | return y(e, ...t);
|
3085 | },
|
3086 | maxWorkers: u
|
3087 | };
|
3088 | })(S, e) : null,
|
3089 | details: {
|
3090 | cpuModel: "",
|
3091 | freemem: () => 0,
|
3092 | platform: "",
|
3093 | release: "",
|
3094 | totalmem: 0
|
3095 | },
|
3096 | copy: async (e, r) => (t.info("todo, copy task", e.length, r), {
|
3097 | diagnostics: [],
|
3098 | dirPaths: [],
|
3099 | filePaths: []
|
3100 | })
|
3101 | };
|
3102 | return S.resolveModuleId = e => ((e, t, r) => {
|
3103 | const s = ((e, t, r) => ({
|
3104 | async isFile(s, n) {
|
3105 | const o = normalizeFsPath(s);
|
3106 | if ((await t.stat(o)).isFile) n(null, !0); else {
|
3107 | if (shouldFetchModule(o) && r.some((e => o.endsWith(e)))) {
|
3108 | const r = getNodeModuleFetchUrl(e, packageVersions, o);
|
3109 | return void n(null, "string" == typeof await fetchModuleAsync(e, t, packageVersions, r, o));
|
3110 | }
|
3111 | n(null, !1);
|
3112 | }
|
3113 | },
|
3114 | async isDirectory(r, s) {
|
3115 | const n = normalizeFsPath(r);
|
3116 | if ((await t.stat(n)).isDirectory) s(null, !0); else {
|
3117 | if (shouldFetchModule(n)) {
|
3118 | if ("node_modules" === path$2.basename(n)) return t.sys.createDirSync(n), t.clearFileCache(n),
|
3119 | void s(null, !0);
|
3120 | if (isCommonDirModuleFile(n)) return void s(null, !1);
|
3121 | for (const r of COMMON_DIR_FILENAMES) {
|
3122 | const o = getCommonDirUrl(e, packageVersions, n, r), i = getCommonDirName(n, r), a = await fetchModuleAsync(e, t, packageVersions, o, i);
|
3123 | if (isString(a)) return void s(null, !0);
|
3124 | }
|
3125 | }
|
3126 | s(null, !1);
|
3127 | }
|
3128 | },
|
3129 | async readFile(e, r) {
|
3130 | const s = normalizeFsPath(e), n = await t.readFile(s);
|
3131 | return isString(n) ? r(null, n) : r(`readFile not found: ${e}`);
|
3132 | },
|
3133 | async realpath(t, r) {
|
3134 | const s = normalizeFsPath(t), n = await e.realpath(s);
|
3135 | n.error && "ENOENT" !== n.error.code ? r(n.error) : r(null, n.error ? s : n.path);
|
3136 | },
|
3137 | extensions: r
|
3138 | }))(e, null, r.exts);
|
3139 | return s.basedir = path$2.dirname(normalizeFsPath(r.containingFile)), r.packageFilter ? s.packageFilter = r.packageFilter : null !== r.packageFilter && (s.packageFilter = e => (isString(e.main) && "" !== e.main || (e.main = "package.json"),
|
3140 | e)), new Promise(((e, t) => {
|
3141 | resolve(r.moduleId, s, ((s, n, o) => {
|
3142 | if (s) t(s); else {
|
3143 | n = normalizePath(n);
|
3144 | const t = {
|
3145 | moduleId: r.moduleId,
|
3146 | resolveId: n,
|
3147 | pkgData: o,
|
3148 | pkgDirPath: getPackageDirPath(n, r.moduleId)
|
3149 | };
|
3150 | e(t);
|
3151 | }
|
3152 | }));
|
3153 | }));
|
3154 | })(S, 0, e), S;
|
3155 | }, createTestingSystem = () => {
|
3156 | let e = 0, t = 0;
|
3157 | const r = createSystem();
|
3158 | r.platformPath = path__default.default, r.generateContentHash = (e, t) => {
|
3159 | let r = crypto$3.createHash("sha1").update(e).digest("hex").toLowerCase();
|
3160 | return "number" == typeof t && (r = r.slice(0, t)), Promise.resolve(r);
|
3161 | };
|
3162 | const s = t => {
|
3163 | const r = t;
|
3164 | return (...t) => (e++, r.apply(r, t));
|
3165 | }, n = e => {
|
3166 | const r = e;
|
3167 | return (...e) => (t++, r.apply(r, e));
|
3168 | };
|
3169 | if (r.access = s(r.access), r.accessSync = s(r.accessSync), r.homeDir = s(r.homeDir),
|
3170 | r.readFile = s(r.readFile), r.readFileSync = s(r.readFileSync), r.readDir = s(r.readDir),
|
3171 | r.readDirSync = s(r.readDirSync), r.stat = s(r.stat), r.statSync = s(r.statSync),
|
3172 | r.copyFile = n(r.copyFile), r.createDir = n(r.createDir), r.createDirSync = n(r.createDirSync),
|
3173 | r.removeFile = n(r.removeFile), r.removeFileSync = n(r.removeFileSync), r.writeFile = n(r.writeFile),
|
3174 | r.writeFileSync = n(r.writeFileSync), r.getCompilerExecutingPath = () => "bin/stencil.js",
|
3175 | Object.defineProperties(r, {
|
3176 | diskReads: {
|
3177 | get: () => e,
|
3178 | set(t) {
|
3179 | e = t;
|
3180 | }
|
3181 | },
|
3182 | diskWrites: {
|
3183 | get: () => t,
|
3184 | set(e) {
|
3185 | t = e;
|
3186 | }
|
3187 | }
|
3188 | }), !function o(e) {
|
3189 | return "diskReads" in e && "diskWrites" in e;
|
3190 | }(r)) throw new Error("could not generate TestingSystem");
|
3191 | return r;
|
3192 | };
|
3193 |
|
3194 | class TestingLogger {
|
3195 | constructor() {
|
3196 | this.isEnabled = !1;
|
3197 | }
|
3198 | setLevel(e) {}
|
3199 | getLevel() {
|
3200 | return "info";
|
3201 | }
|
3202 | enableColors(e) {}
|
3203 | emoji(e) {
|
3204 | return "";
|
3205 | }
|
3206 | info(...e) {
|
3207 | this.isEnabled && console.log(...e);
|
3208 | }
|
3209 | warn(...e) {
|
3210 | this.isEnabled && console.warn(...e);
|
3211 | }
|
3212 | error(...e) {
|
3213 | this.isEnabled && console.error(...e);
|
3214 | }
|
3215 | debug(...e) {
|
3216 | this.isEnabled && console.log(...e);
|
3217 | }
|
3218 | color(e, t) {}
|
3219 | red(e) {
|
3220 | return e;
|
3221 | }
|
3222 | green(e) {
|
3223 | return e;
|
3224 | }
|
3225 | yellow(e) {
|
3226 | return e;
|
3227 | }
|
3228 | blue(e) {
|
3229 | return e;
|
3230 | }
|
3231 | magenta(e) {
|
3232 | return e;
|
3233 | }
|
3234 | cyan(e) {
|
3235 | return e;
|
3236 | }
|
3237 | gray(e) {
|
3238 | return e;
|
3239 | }
|
3240 | bold(e) {
|
3241 | return e;
|
3242 | }
|
3243 | dim(e) {
|
3244 | return e;
|
3245 | }
|
3246 | bgRed(e) {
|
3247 | return e;
|
3248 | }
|
3249 | createTimeSpan(e, t = !1) {
|
3250 | return {
|
3251 | duration: () => 0,
|
3252 | finish: () => 0
|
3253 | };
|
3254 | }
|
3255 | printDiagnostics(e) {}
|
3256 | }
|
3257 |
|
3258 | const createConfigFlags = (e = {}) => ({
|
3259 | task: null,
|
3260 | args: [],
|
3261 | knownArgs: [],
|
3262 | unknownArgs: [],
|
3263 | ...e
|
3264 | });
|
3265 |
|
3266 | class EventSpy {
|
3267 | constructor(e) {
|
3268 | this.eventName = e, this.events = [], this.cursor = 0, this.queuedHandler = [];
|
3269 | }
|
3270 | get length() {
|
3271 | return this.events.length;
|
3272 | }
|
3273 | get firstEvent() {
|
3274 | return this.events[0] || null;
|
3275 | }
|
3276 | get lastEvent() {
|
3277 | return this.events[this.events.length - 1] || null;
|
3278 | }
|
3279 | next() {
|
3280 | const e = this.cursor;
|
3281 | this.cursor++;
|
3282 | const t = this.events[e];
|
3283 | if (t) return Promise.resolve({
|
3284 | done: !1,
|
3285 | value: t
|
3286 | });
|
3287 | {
|
3288 | let t;
|
3289 | const r = new Promise((e => t = e));
|
3290 | return this.queuedHandler.push(t), r.then((() => ({
|
3291 | done: !1,
|
3292 | value: this.events[e]
|
3293 | })));
|
3294 | }
|
3295 | }
|
3296 | push(e) {
|
3297 | this.events.push(e);
|
3298 | const t = this.queuedHandler.shift();
|
3299 | t && t();
|
3300 | }
|
3301 | }
|
3302 |
|
3303 | class E2EElement extends index_cjs.MockHTMLElement {
|
3304 | constructor(e, t) {
|
3305 | super(null, null), this._page = e, this._elmHandle = t, this._queuedActions = [],
|
3306 | e._e2eElements.push(this);
|
3307 | }
|
3308 | _queueAction(e) {
|
3309 | this._queuedActions.push(e);
|
3310 | }
|
3311 | find(e) {
|
3312 | return find(this._page, this._elmHandle, e);
|
3313 | }
|
3314 | findAll(e) {
|
3315 | return findAll(this._page, this._elmHandle, e);
|
3316 | }
|
3317 | callMethod(e, ...t) {
|
3318 | return this._queueAction({
|
3319 | methodName: e,
|
3320 | methodArgs: t
|
3321 | }), this.e2eRunActions();
|
3322 | }
|
3323 | triggerEvent(e, t) {
|
3324 | this._queueAction({
|
3325 | eventName: e,
|
3326 | eventInitDict: t
|
3327 | });
|
3328 | }
|
3329 | async spyOnEvent(e) {
|
3330 | const t = new EventSpy(e);
|
3331 | return await addE2EListener(this._page, this._elmHandle, e, (e => {
|
3332 | t.push(e);
|
3333 | })), t;
|
3334 | }
|
3335 | async click(e) {
|
3336 | await this._elmHandle.click(e), await this._page.waitForChanges();
|
3337 | }
|
3338 | async focus() {
|
3339 | await this._elmHandle.focus(), await this._page.waitForChanges();
|
3340 | }
|
3341 | async hover() {
|
3342 | await this._elmHandle.hover(), await this._page.waitForChanges();
|
3343 | }
|
3344 | async isVisible() {
|
3345 | this._validate();
|
3346 | let e = !1;
|
3347 | try {
|
3348 | const t = this._elmHandle.executionContext();
|
3349 | e = await t.evaluate((e => new Promise((t => {
|
3350 | window.requestAnimationFrame((() => {
|
3351 | if (e.isConnected) {
|
3352 | const r = window.getComputedStyle(e);
|
3353 | r && "none" !== r.display && "hidden" !== r.visibility && "0" !== r.opacity ? window.requestAnimationFrame((() => {
|
3354 | e.clientWidth, t(!0);
|
3355 | })) : t(!1);
|
3356 | } else t(!1);
|
3357 | }));
|
3358 | }))), this._elmHandle);
|
3359 | } catch (e) {}
|
3360 | return e;
|
3361 | }
|
3362 | waitForEvent(e) {
|
3363 | return waitForEvent(this._page, e, this._elmHandle);
|
3364 | }
|
3365 | waitForVisible() {
|
3366 | return new Promise(((e, t) => {
|
3367 | const r = setInterval((async () => {
|
3368 | await this.isVisible() && (clearInterval(r), clearTimeout(o), e());
|
3369 | }), 10), s = .5 * jasmine.DEFAULT_TIMEOUT_INTERVAL, n = new Error(`waitForVisible timed out: ${s}ms`), o = setTimeout((() => {
|
3370 | clearTimeout(r), t(n);
|
3371 | }), s);
|
3372 | }));
|
3373 | }
|
3374 | waitForNotVisible() {
|
3375 | return new Promise(((e, t) => {
|
3376 | const r = setInterval((async () => {
|
3377 | await this.isVisible() || (clearInterval(r), clearTimeout(o), e());
|
3378 | }), 10), s = .5 * jasmine.DEFAULT_TIMEOUT_INTERVAL, n = new Error(`waitForNotVisible timed out: ${s}ms`), o = setTimeout((() => {
|
3379 | clearTimeout(r), t(n);
|
3380 | }), s);
|
3381 | }));
|
3382 | }
|
3383 | isIntersectingViewport() {
|
3384 | return this._elmHandle.isIntersectingViewport();
|
3385 | }
|
3386 | async press(e, t) {
|
3387 | await this._elmHandle.press(e, t), await this._page.waitForChanges();
|
3388 | }
|
3389 | async tap() {
|
3390 | await this._elmHandle.tap(), await this._page.waitForChanges();
|
3391 | }
|
3392 | async type(e, t) {
|
3393 | await this._elmHandle.type(e, t), await this._page.waitForChanges();
|
3394 | }
|
3395 | async getProperty(e) {
|
3396 | this._validate();
|
3397 | const t = this._elmHandle.executionContext();
|
3398 | return await t.evaluate(((e, t) => e[t]), this._elmHandle, e);
|
3399 | }
|
3400 | setProperty(e, t) {
|
3401 | this._queueAction({
|
3402 | setPropertyName: e,
|
3403 | setPropertyValue: t
|
3404 | });
|
3405 | }
|
3406 | getAttribute(e) {
|
3407 | return this._validate(), super.getAttribute(e);
|
3408 | }
|
3409 | setAttribute(e, t) {
|
3410 | this._queueAction({
|
3411 | setAttributeName: e,
|
3412 | setAttributeValue: t
|
3413 | });
|
3414 | }
|
3415 | removeAttribute(e) {
|
3416 | this._queueAction({
|
3417 | removeAttribute: e
|
3418 | });
|
3419 | }
|
3420 | toggleAttribute(e, t) {
|
3421 | this._queueAction({
|
3422 | toggleAttributeName: e,
|
3423 | toggleAttributeForce: t
|
3424 | });
|
3425 | }
|
3426 | get classList() {
|
3427 | return {
|
3428 | add: (...e) => {
|
3429 | e.forEach((e => {
|
3430 | this._queueAction({
|
3431 | classAdd: e
|
3432 | });
|
3433 | }));
|
3434 | },
|
3435 | remove: (...e) => {
|
3436 | e.forEach((e => {
|
3437 | this._queueAction({
|
3438 | classRemove: e
|
3439 | });
|
3440 | }));
|
3441 | },
|
3442 | toggle: e => {
|
3443 | this._queueAction({
|
3444 | classToggle: e
|
3445 | });
|
3446 | },
|
3447 | contains: e => (this._validate(), super.className.split(" ").includes(e))
|
3448 | };
|
3449 | }
|
3450 | get className() {
|
3451 | return this._validate(), super.className;
|
3452 | }
|
3453 | set className(e) {
|
3454 | this._queueAction({
|
3455 | setPropertyName: "className",
|
3456 | setPropertyValue: e
|
3457 | });
|
3458 | }
|
3459 | get id() {
|
3460 | return this._validate(), super.id;
|
3461 | }
|
3462 | set id(e) {
|
3463 | this._queueAction({
|
3464 | setPropertyName: "id",
|
3465 | setPropertyValue: e
|
3466 | });
|
3467 | }
|
3468 | get innerHTML() {
|
3469 | return this._validate(), super.innerHTML;
|
3470 | }
|
3471 | set innerHTML(e) {
|
3472 | this._queueAction({
|
3473 | setPropertyName: "innerHTML",
|
3474 | setPropertyValue: e
|
3475 | });
|
3476 | }
|
3477 | get innerText() {
|
3478 | return this._validate(), super.innerText;
|
3479 | }
|
3480 | set innerText(e) {
|
3481 | this._queueAction({
|
3482 | setPropertyName: "innerText",
|
3483 | setPropertyValue: e
|
3484 | });
|
3485 | }
|
3486 | get nodeValue() {
|
3487 | return this._validate(), super.nodeValue;
|
3488 | }
|
3489 | set nodeValue(e) {
|
3490 | "string" == typeof e && this._queueAction({
|
3491 | setPropertyName: "nodeValue",
|
3492 | setPropertyValue: e
|
3493 | });
|
3494 | }
|
3495 | get outerHTML() {
|
3496 | return this._validate(), super.outerHTML;
|
3497 | }
|
3498 | set outerHTML(e) {
|
3499 | throw new Error("outerHTML is read-only");
|
3500 | }
|
3501 | get shadowRoot() {
|
3502 | return this._validate(), super.shadowRoot;
|
3503 | }
|
3504 | set shadowRoot(e) {
|
3505 | super.shadowRoot = e;
|
3506 | }
|
3507 | get tabIndex() {
|
3508 | return this._validate(), super.tabIndex;
|
3509 | }
|
3510 | set tabIndex(e) {
|
3511 | this._queueAction({
|
3512 | setPropertyName: "tabIndex",
|
3513 | setPropertyValue: e
|
3514 | });
|
3515 | }
|
3516 | get textContent() {
|
3517 | return this._validate(), super.textContent;
|
3518 | }
|
3519 | set textContent(e) {
|
3520 | this._queueAction({
|
3521 | setPropertyName: "textContent",
|
3522 | setPropertyValue: e
|
3523 | });
|
3524 | }
|
3525 | get title() {
|
3526 | return this._validate(), super.title;
|
3527 | }
|
3528 | set title(e) {
|
3529 | this._queueAction({
|
3530 | setPropertyName: "title",
|
3531 | setPropertyValue: e
|
3532 | });
|
3533 | }
|
3534 | async getComputedStyle(e) {
|
3535 | const t = await this._page.evaluate(((e, t) => {
|
3536 | const r = {}, s = window.getComputedStyle(e, t);
|
3537 | return Object.keys(s).forEach((e => {
|
3538 | if (isNaN(e)) {
|
3539 | const t = s[e];
|
3540 | null != t && (r[e] = t);
|
3541 | } else {
|
3542 | const t = s[e];
|
3543 | if (t.includes("-")) {
|
3544 | const e = s.getPropertyValue(t);
|
3545 | null != e && (r[t] = e);
|
3546 | }
|
3547 | }
|
3548 | })), r;
|
3549 | }), this._elmHandle, e);
|
3550 | return t.getPropertyValue = e => t[e], t;
|
3551 | }
|
3552 | async e2eRunActions() {
|
3553 | if (0 === this._queuedActions.length) return;
|
3554 | const e = this._elmHandle.executionContext(), t = await e.evaluate(((e, t) => e.componentOnReady().then((() => {
|
3555 | let r = null;
|
3556 | return t.forEach((t => {
|
3557 | if (t.methodName) r = e[t.methodName].apply(e, t.methodArgs); else if (t.setPropertyName) e[t.setPropertyName] = t.setPropertyValue; else if (t.setAttributeName) e.setAttribute(t.setAttributeName, t.setAttributeValue); else if (t.removeAttribute) e.removeAttribute(t.removeAttribute); else if (t.toggleAttributeName) "boolean" == typeof t.toggleAttributeForce ? e.toggleAttribute(t.toggleAttributeName, t.toggleAttributeForce) : e.toggleAttribute(t.toggleAttributeName); else if (t.classAdd) e.classList.add(t.classAdd); else if (t.classRemove) e.classList.remove(t.classRemove); else if (t.classToggle) e.classList.toggle(t.classToggle); else if (t.eventName) {
|
3558 | const r = t.eventInitDict || {};
|
3559 | "boolean" != typeof r.bubbles && (r.bubbles = !0), "boolean" != typeof r.cancelable && (r.cancelable = !0),
|
3560 | "boolean" != typeof r.composed && (r.composed = !0);
|
3561 | const s = new CustomEvent(t.eventName, r);
|
3562 | e.dispatchEvent(s);
|
3563 | }
|
3564 | })), r && "function" == typeof r.then ? r.then((e => e)) : r;
|
3565 | }))), this._elmHandle, this._queuedActions);
|
3566 | return this._queuedActions.length = 0, t;
|
3567 | }
|
3568 | async e2eSync() {
|
3569 | const e = this._elmHandle.executionContext(), {outerHTML: t, shadowRootHTML: r} = await e.evaluate((e => ({
|
3570 | outerHTML: e.outerHTML,
|
3571 | shadowRootHTML: e.shadowRoot ? e.shadowRoot.innerHTML : null
|
3572 | })), this._elmHandle);
|
3573 | "string" == typeof r ? (this.shadowRoot = index_cjs.parseHtmlToFragment(r), this.shadowRoot.host = this) : this.shadowRoot = null;
|
3574 | const s = index_cjs.parseHtmlToFragment(t).firstElementChild;
|
3575 | for (this.nodeName = s.nodeName, this.attributes = index_cjs.cloneAttributes(s.attributes); this.childNodes.length > 0; ) this.removeChild(this.childNodes[0]);
|
3576 | for (;s.childNodes.length > 0; ) this.appendChild(s.childNodes[0]);
|
3577 | }
|
3578 | _validate() {
|
3579 | if (this._queuedActions.length > 0) throw new Error("await page.waitForChanges() must be called before reading element information");
|
3580 | }
|
3581 | async e2eDispose() {
|
3582 | this._elmHandle && (await this._elmHandle.dispose(), this._elmHandle = null);
|
3583 | const e = this._page._e2eElements.indexOf(this);
|
3584 | e > -1 && this._page._e2eElements.splice(e, 1), this._page = null;
|
3585 | }
|
3586 | }
|
3587 |
|
3588 | const env = process.env;
|
3589 |
|
3590 | exports.MockHeaders = MockHeaders, exports.MockRequest = MockRequest, exports.MockResponse = MockResponse,
|
3591 | exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment() {
|
3592 | const e = require("jest-environment-node");
|
3593 | return class extends e {
|
3594 | constructor(e) {
|
3595 | super(e), this.browser = null, this.pages = [];
|
3596 | }
|
3597 | async setup() {
|
3598 | "true" === process.env.__STENCIL_E2E_TESTS__ && (this.global.__NEW_TEST_PAGE__ = this.newPuppeteerPage.bind(this),
|
3599 | this.global.__CLOSE_OPEN_PAGES__ = this.closeOpenPages.bind(this));
|
3600 | }
|
3601 | async newPuppeteerPage() {
|
3602 | this.browser || (this.browser = await async function e() {
|
3603 | const e = process.env, t = e.__STENCIL_BROWSER_WS_ENDPOINT__;
|
3604 | if (!t) return null;
|
3605 | const r = {
|
3606 | browserWSEndpoint: t,
|
3607 | ignoreHTTPSErrors: !0
|
3608 | }, s = require(e.__STENCIL_PUPPETEER_MODULE__);
|
3609 | return await s.connect(r);
|
3610 | }());
|
3611 | const t = await function r(e) {
|
3612 | return e.newPage();
|
3613 | }(this.browser);
|
3614 | this.pages.push(t);
|
3615 | const s = process.env;
|
3616 | return "string" == typeof s.__STENCIL_DEFAULT_TIMEOUT__ && t.setDefaultTimeout(parseInt(s.__STENCIL_DEFAULT_TIMEOUT__, 10)),
|
3617 | t;
|
3618 | }
|
3619 | async closeOpenPages() {
|
3620 | await Promise.all(this.pages.map((e => e.close()))), this.pages.length = 0;
|
3621 | }
|
3622 | async teardown() {
|
3623 | await super.teardown(), await this.closeOpenPages(), await async function e(t) {
|
3624 | if (t) try {
|
3625 | t.disconnect();
|
3626 | } catch (e) {}
|
3627 | }(this.browser), this.browser = null;
|
3628 | }
|
3629 | getVmContext() {
|
3630 | return super.getVmContext();
|
3631 | }
|
3632 | };
|
3633 | }, exports.createTestRunner = function createTestRunner() {
|
3634 | var e;
|
3635 | const t = null !== (e = require("jest-runner").default) && void 0 !== e ? e : require("jest-runner");
|
3636 | return class r extends t {
|
3637 | async runTests(e, t, r, s, n, o) {
|
3638 | const i = process.env;
|
3639 | if (e = e.filter((e => function t(e, r) {
|
3640 | const s = (e = e.toLowerCase().replace(/\\/g, "/")).includes(".e2e.") || e.includes("/e2e.");
|
3641 | return !("true" !== r.__STENCIL_E2E_TESTS__ || !s) || "true" === r.__STENCIL_SPEC_TESTS__ && !s;
|
3642 | }(e.path, i))), "true" === i.__STENCIL_SCREENSHOT__) {
|
3643 | const a = JSON.parse(i.__STENCIL_EMULATE_CONFIGS__);
|
3644 | for (let l = 0; l < a.length; l++) setScreenshotEmulateData(a[l], i), await super.runTests(e, t, r, s, n, o);
|
3645 | } else await super.runTests(e, t, r, s, n, o);
|
3646 | }
|
3647 | };
|
3648 | }, exports.createTesting = async e => {
|
3649 | e = function t(e) {
|
3650 | return e.buildEs5 = !1, e.devMode = !0, e.minifyCss = !1, e.minifyJs = !1, e.hashFileNames = !1,
|
3651 | e.validateTypes = !1, e._isTesting = !0, e.buildDist = !0, e.flags.serve = !1, e.flags.open = !1,
|
3652 | e.outputTargets.forEach((e => {
|
3653 | "www" === e.type && (e.serviceWorker = null);
|
3654 | })), e.flags.args.includes("--watchAll") && (e.watch = !0), e;
|
3655 | }(e);
|
3656 | const {createCompiler: r} = require("../compiler/stencil.js"), s = await r(e);
|
3657 | let n, o;
|
3658 | const i = async () => {
|
3659 | const t = [];
|
3660 | e && (e.sys && e.sys.destroy && t.push(e.sys.destroy()), e = null), n && (n.close && t.push(n.close()),
|
3661 | n = null), o && (o.close && t.push(o.close()), o = null), await Promise.all(t);
|
3662 | };
|
3663 | return {
|
3664 | destroy: i,
|
3665 | run: async (t = {}) => {
|
3666 | let r, a = !1, l = !1, c = null;
|
3667 | const u = [];
|
3668 | try {
|
3669 | if (!t.spec && !t.e2e) return e.logger.error("Testing requires either the --spec or --e2e command line flags, or both. For example, to run unit tests, use the command: stencil test --spec"),
|
3670 | !1;
|
3671 | if (r = process.env, t.e2e && (u.push("e2e"), r.__STENCIL_E2E_TESTS__ = "true"),
|
3672 | t.spec && (u.push("spec"), r.__STENCIL_SPEC_TESTS__ = "true"), e.logger.info(e.logger.magenta(`testing ${u.join(" and ")} files${e.watch ? " (watch)" : ""}`)),
|
3673 | a = !(!t.e2e || !t.screenshot), a && (r.__STENCIL_SCREENSHOT__ = "true", t.updateScreenshot ? e.logger.info(e.logger.magenta("updating master screenshots")) : e.logger.info(e.logger.magenta("comparing against master screenshots"))),
|
3674 | t.e2e) {
|
3675 | let t = null;
|
3676 | e.outputTargets.forEach((e => {
|
3677 | e.empty = !1;
|
3678 | }));
|
3679 | const a = !(e.flags && !1 === e.flags.build);
|
3680 | a && e.watch && (c = await s.createWatcher()), a && (c ? (t = new Promise((e => {
|
3681 | const t = c.on("buildFinish", (r => {
|
3682 | t(), e(r);
|
3683 | }));
|
3684 | })), c.start()) : t = s.build()), e.devServer.openBrowser = !1, e.devServer.gzip = !1,
|
3685 | e.devServer.reloadStrategy = null;
|
3686 | const l = await Promise.all([ index_js.start(e.devServer, e.logger), startPuppeteerBrowser(e) ]);
|
3687 | if (n = l[0], o = l[1], t) {
|
3688 | const r = await t;
|
3689 | if (!r || !e.watch && hasError(r && r.diagnostics)) return await i(), !1;
|
3690 | }
|
3691 | n && (r.__STENCIL_BROWSER_URL__ = n.browserUrl, e.logger.debug(`e2e dev server url: ${r.__STENCIL_BROWSER_URL__}`),
|
3692 | r.__STENCIL_APP_SCRIPT_URL__ = function d(e, t) {
|
3693 | return getAppUrl(e, t, `${e.fsNamespace}.esm.js`);
|
3694 | }(e, n.browserUrl), e.logger.debug(`e2e app script url: ${r.__STENCIL_APP_SCRIPT_URL__}`),
|
3695 | getAppStyleUrl(e, n.browserUrl) && (r.__STENCIL_APP_STYLE_URL__ = getAppStyleUrl(e, n.browserUrl),
|
3696 | e.logger.debug(`e2e app style url: ${r.__STENCIL_APP_STYLE_URL__}`)));
|
3697 | }
|
3698 | } catch (t) {
|
3699 | return e.logger.error(t), !1;
|
3700 | }
|
3701 | try {
|
3702 | l = a ? await async function h(e, t) {
|
3703 | e.logger.debug(`screenshot connector: ${e.testing.screenshotConnector}`);
|
3704 | const r = new (require(e.testing.screenshotConnector)), s = path$2.join(e.sys.getCompilerExecutingPath(), "..", "..", "screenshot", "pixel-match.js");
|
3705 | e.logger.debug(`pixelmatch module: ${s}`);
|
3706 | const n = e.logger.createTimeSpan("screenshot, initBuild started", !0);
|
3707 | await r.initBuild({
|
3708 | buildId: createBuildId(),
|
3709 | buildMessage: createBuildMessage(),
|
3710 | buildTimestamp: Date.now(),
|
3711 | appNamespace: e.namespace,
|
3712 | rootDir: e.rootDir,
|
3713 | cacheDir: e.cacheDir,
|
3714 | packageDir: path$2.join(e.sys.getCompilerExecutingPath(), "..", ".."),
|
3715 | updateMaster: e.flags.updateScreenshot,
|
3716 | logger: e.logger,
|
3717 | allowableMismatchedPixels: e.testing.allowableMismatchedPixels,
|
3718 | allowableMismatchedRatio: e.testing.allowableMismatchedRatio,
|
3719 | pixelmatchThreshold: e.testing.pixelmatchThreshold,
|
3720 | waitBeforeScreenshot: e.testing.waitBeforeScreenshot,
|
3721 | pixelmatchModulePath: s
|
3722 | }), e.flags.updateScreenshot || await r.pullMasterBuild(), n.finish("screenshot, initBuild finished");
|
3723 | const o = await Promise.all([ await r.getMasterBuild(), await r.getScreenshotCache() ]), i = o[0], a = o[1];
|
3724 | t.__STENCIL_SCREENSHOT_BUILD__ = r.toJson(i, a);
|
3725 | const l = e.logger.createTimeSpan("screenshot, tests started", !0), c = await runJest(e, t);
|
3726 | l.finish(`screenshot, tests finished, passed: ${c}`);
|
3727 | try {
|
3728 | const t = e.logger.createTimeSpan("screenshot, completeTimespan started", !0);
|
3729 | let s = await r.completeBuild(i);
|
3730 | if (t.finish("screenshot, completeTimespan finished"), s) {
|
3731 | const t = e.logger.createTimeSpan("screenshot, publishBuild started", !0);
|
3732 | if (s = await r.publishBuild(s), t.finish("screenshot, publishBuild finished"),
|
3733 | e.flags.updateScreenshot) s.currentBuild && "string" == typeof s.currentBuild.previewUrl && e.logger.info(e.logger.magenta(s.currentBuild.previewUrl)); else if (s.compare) {
|
3734 | try {
|
3735 | await r.updateScreenshotCache(a, s);
|
3736 | } catch (t) {
|
3737 | e.logger.error(t);
|
3738 | }
|
3739 | e.logger.info(`screenshots compared: ${s.compare.diffs.length}`), "string" == typeof s.compare.url && e.logger.info(e.logger.magenta(s.compare.url));
|
3740 | }
|
3741 | }
|
3742 | } catch (t) {
|
3743 | t instanceof Error ? e.logger.error(t, t.stack) : e.logger.error(t);
|
3744 | }
|
3745 | return c;
|
3746 | }(e, r) : await runJest(e, r), e.logger.info(""), c && await c.close();
|
3747 | } catch (t) {
|
3748 | e.logger.error(t);
|
3749 | }
|
3750 | return l;
|
3751 | }
|
3752 | };
|
3753 | }, exports.jestPreprocessor = jestPreprocessor, exports.jestSetupTestFramework = function jestSetupTestFramework() {
|
3754 | global.Context = {}, global.resourcesUrl = "/build", expect.extend(expectExtend),
|
3755 | expect.addSnapshotSerializer(HtmlSerializer), index_cjs.setupGlobal(global), function e(t) {
|
3756 | const r = t.window;
|
3757 | "fetch" in r || (r.fetch = function(e) {
|
3758 | return globalMockFetch(e);
|
3759 | }), "fetch" in t || (t.fetch = function(e) {
|
3760 | return globalMockFetch(e);
|
3761 | });
|
3762 | }(global), beforeEach((() => {
|
3763 | testing.resetPlatform(), testing.setErrorHandler(void 0), resetBuildConditionals(appData.BUILD),
|
3764 | testing.modeResolutionChain.length = 0;
|
3765 | })), afterEach((async () => {
|
3766 | global.__CLOSE_OPEN_PAGES__ && await global.__CLOSE_OPEN_PAGES__(), testing.stopAutoApplyChanges(),
|
3767 | index_cjs.teardownGlobal(global), global.Context = {}, global.resourcesUrl = "/build";
|
3768 | }));
|
3769 | const t = jasmine.getEnv();
|
3770 | null != t && t.addReporter({
|
3771 | specStarted: e => {
|
3772 | global.currentSpec = e;
|
3773 | }
|
3774 | }), global.screenshotDescriptions = new Set;
|
3775 | const r = process.env;
|
3776 | if ("string" == typeof r.__STENCIL_DEFAULT_TIMEOUT__) {
|
3777 | const e = parseInt(r.__STENCIL_DEFAULT_TIMEOUT__, 10);
|
3778 | jest.setTimeout(1.5 * e), jasmine.DEFAULT_TIMEOUT_INTERVAL = e;
|
3779 | }
|
3780 | if ("string" == typeof r.__STENCIL_ENV__) {
|
3781 | const e = JSON.parse(r.__STENCIL_ENV__);
|
3782 | Object.assign(appData.Env, e);
|
3783 | }
|
3784 | }, exports.mockBuildCtx = function mockBuildCtx(e, t) {
|
3785 | return e || (e = mockConfig()), t || (t = mockCompilerCtx(e)), new BuildContext(e, t);
|
3786 | }, exports.mockCompilerCtx = mockCompilerCtx, exports.mockCompilerSystem = function mockCompilerSystem() {
|
3787 | return createTestingSystem();
|
3788 | }, exports.mockConfig = mockConfig, exports.mockDocument = function mockDocument(e = null) {
|
3789 | return new index_cjs.MockWindow(e).document;
|
3790 | }, exports.mockFetch = mockFetch, exports.mockLoadConfigInit = e => ({
|
3791 | config: {},
|
3792 | configPath: void 0,
|
3793 | initTsConfig: !0,
|
3794 | logger: void 0,
|
3795 | sys: void 0,
|
3796 | ...e
|
3797 | }), exports.mockLogger = mockLogger, exports.mockModule = (e = {}) => ({
|
3798 | cmps: [],
|
3799 | coreRuntimeApis: [],
|
3800 | collectionName: "",
|
3801 | dtsFilePath: "",
|
3802 | excludeFromCollection: !1,
|
3803 | externalImports: [],
|
3804 | htmlAttrNames: [],
|
3805 | htmlTagNames: [],
|
3806 | htmlParts: [],
|
3807 | isCollectionDependency: !1,
|
3808 | isLegacy: !1,
|
3809 | jsFilePath: "",
|
3810 | localImports: [],
|
3811 | originalImports: [],
|
3812 | originalCollectionComponentPath: "",
|
3813 | potentialCmpRefs: [],
|
3814 | sourceFilePath: "",
|
3815 | staticSourceFile: "",
|
3816 | staticSourceFileText: "",
|
3817 | sourceMapPath: "",
|
3818 | sourceMapFileText: "",
|
3819 | hasVdomAttribute: !1,
|
3820 | hasVdomClass: !1,
|
3821 | hasVdomFunctional: !1,
|
3822 | hasVdomKey: !1,
|
3823 | hasVdomListener: !1,
|
3824 | hasVdomPropOrAttr: !1,
|
3825 | hasVdomRef: !1,
|
3826 | hasVdomRender: !1,
|
3827 | hasVdomStyle: !1,
|
3828 | hasVdomText: !1,
|
3829 | hasVdomXlink: !1,
|
3830 | ...e
|
3831 | }), exports.mockValidatedConfig = function mockValidatedConfig(e = {}) {
|
3832 | var t;
|
3833 | const r = mockConfig(e);
|
3834 | return {
|
3835 | ...r,
|
3836 | flags: createConfigFlags(),
|
3837 | logger: mockLogger(),
|
3838 | outputTargets: null !== (t = r.outputTargets) && void 0 !== t ? t : [],
|
3839 | rootDir: path__default.default.resolve("/"),
|
3840 | sys: createTestingSystem(),
|
3841 | testing: {},
|
3842 | ...e
|
3843 | };
|
3844 | }, exports.mockWindow = function mockWindow(e = null) {
|
3845 | return new index_cjs.MockWindow(e);
|
3846 | }, exports.newE2EPage = async function newE2EPage(e = {}) {
|
3847 | if (!global.__NEW_TEST_PAGE__) throw new Error("newE2EPage() is only available from E2E tests, and ran with the --e2e cmd line flag.");
|
3848 | const t = await global.__NEW_TEST_PAGE__(), r = [];
|
3849 | try {
|
3850 | t._e2eElements = [], t._e2eGoto = t.goto, t._e2eClose = t.close, await async function s(e) {
|
3851 | if (e.isClosed()) return;
|
3852 | const t = env.__STENCIL_EMULATE__;
|
3853 | if (!t) return;
|
3854 | const r = JSON.parse(t), s = {
|
3855 | viewport: r.viewport,
|
3856 | userAgent: r.userAgent
|
3857 | };
|
3858 | await e.emulate(s);
|
3859 | }(t), await t.setCacheEnabled(!1), await initPageEvents(t), function n(e) {
|
3860 | const t = process.env;
|
3861 | "true" === t.__STENCIL_SCREENSHOT__ ? e.compareScreenshot = (r, s) => {
|
3862 | const n = global;
|
3863 | let o, i = "", a = "";
|
3864 | if (n.currentSpec && ("string" == typeof n.currentSpec.fullName && (i = n.currentSpec.fullName),
|
3865 | "string" == typeof n.currentSpec.testPath && (a = n.currentSpec.testPath)), "string" == typeof r ? (i.length > 0 ? i += ", " + r : i = r,
|
3866 | "object" == typeof s && (o = s)) : "object" == typeof r && (o = r), i = i.trim(),
|
3867 | o = o || {}, !i) throw new Error(`Invalid screenshot description in "${a}"`);
|
3868 | if (n.screenshotDescriptions.has(i)) throw new Error(`Screenshot description "${i}" found in "${a}" cannot be used for multiple screenshots and must be unique. To make screenshot descriptions unique within the same test, use the first argument to "compareScreenshot", such as "compareScreenshot('more to the description')".`);
|
3869 | return n.screenshotDescriptions.add(i), async function l(e, t, r, s, n) {
|
3870 | if ("string" != typeof t.__STENCIL_EMULATE__) throw new Error("compareScreenshot, missing screenshot emulate env var");
|
3871 | if ("string" != typeof t.__STENCIL_SCREENSHOT_BUILD__) throw new Error("compareScreenshot, missing screen build env var");
|
3872 | const o = JSON.parse(t.__STENCIL_EMULATE__), i = JSON.parse(t.__STENCIL_SCREENSHOT_BUILD__);
|
3873 | await function a(e) {
|
3874 | return new Promise((t => setTimeout(t, e)));
|
3875 | }(i.timeoutBeforeScreenshot), await e.evaluate((() => new Promise((e => {
|
3876 | window.requestAnimationFrame((() => {
|
3877 | e();
|
3878 | }));
|
3879 | }))));
|
3880 | const l = function c(e) {
|
3881 | const t = {
|
3882 | type: "png",
|
3883 | fullPage: e.fullPage,
|
3884 | omitBackground: e.omitBackground,
|
3885 | encoding: "binary"
|
3886 | };
|
3887 | return e.clip && (t.clip = {
|
3888 | x: e.clip.x,
|
3889 | y: e.clip.y,
|
3890 | width: e.clip.width,
|
3891 | height: e.clip.height
|
3892 | }), t;
|
3893 | }(n), u = await e.screenshot(l), d = "number" == typeof n.pixelmatchThreshold ? n.pixelmatchThreshold : i.pixelmatchThreshold;
|
3894 | let h = o.viewport.width, p = o.viewport.height;
|
3895 | return n && n.clip && ("number" == typeof n.clip.width && (h = n.clip.width), "number" == typeof n.clip.height && (p = n.clip.height)),
|
3896 | await compareScreenshot(o, i, u, r, h, p, s, d);
|
3897 | }(e, t, i, a, o);
|
3898 | } : e.compareScreenshot = async () => ({
|
3899 | mismatchedPixels: 0,
|
3900 | allowableMismatchedPixels: 1,
|
3901 | allowableMismatchedRatio: 1,
|
3902 | desc: "",
|
3903 | width: 1,
|
3904 | height: 1,
|
3905 | deviceScaleFactor: 1
|
3906 | });
|
3907 | }(t);
|
3908 | let s = null;
|
3909 | t.close = async e => {
|
3910 | try {
|
3911 | if (Array.isArray(t._e2eElements)) {
|
3912 | const e = t._e2eElements.map((async e => {
|
3913 | "function" == typeof e.e2eDispose && await e.e2eDispose();
|
3914 | }));
|
3915 | await Promise.all(e);
|
3916 | }
|
3917 | } catch (e) {}
|
3918 | const r = () => {
|
3919 | throw new Error("The page was already closed");
|
3920 | };
|
3921 | t._e2eElements = r, t._e2eEvents = r, t._e2eGoto = r, t.find = r, t.debugger = r,
|
3922 | t.findAll = r, t.compareScreenshot = r, t.setContent = r, t.spyOnEvent = r, t.waitForChanges = r,
|
3923 | t.waitForEvent = r;
|
3924 | try {
|
3925 | t.isClosed() || await t._e2eClose(e);
|
3926 | } catch (e) {}
|
3927 | };
|
3928 | const n = async () => (s || (s = t.evaluateHandle((() => document))), (await s).asElement());
|
3929 | t.find = async e => {
|
3930 | const r = await n();
|
3931 | return find(t, r, e);
|
3932 | }, t.findAll = async e => {
|
3933 | const r = await n();
|
3934 | return findAll(t, r, e);
|
3935 | }, t.waitForEvent = async e => {
|
3936 | const r = await n();
|
3937 | return waitForEvent(t, e, r);
|
3938 | }, t.getDiagnostics = () => r, t.waitForChanges = waitForChanges.bind(null, t),
|
3939 | t.debugger = () => {
|
3940 | if ("true" !== env.__STENCIL_E2E_DEVTOOLS__) throw new Error("Set the --devtools flag in order to use E2EPage.debugger()");
|
3941 | return t.evaluate((() => new Promise((e => {
|
3942 | e();
|
3943 | }))));
|
3944 | };
|
3945 | const o = !0 === e.failOnConsoleError, i = !0 === e.failOnNetworkError;
|
3946 | t.on("console", (e => {
|
3947 | if ("error" === e.type() && (r.push({
|
3948 | type: "error",
|
3949 | message: e.text(),
|
3950 | location: e.location().url
|
3951 | }), o)) throw new Error(serializeConsoleMessage(e));
|
3952 | !function t(e) {
|
3953 | const t = serializeConsoleMessage(e), r = e.type(), s = "warning" === r ? "warn" : r;
|
3954 | "debug" !== s && ("function" == typeof console[s] ? console[s](t) : console.log(r, t));
|
3955 | }(e);
|
3956 | })), t.on("pageerror", (e => {
|
3957 | throw r.push({
|
3958 | type: "pageerror",
|
3959 | message: e.message,
|
3960 | location: e.stack
|
3961 | }), e;
|
3962 | })), t.on("requestfailed", (e => {
|
3963 | if (r.push({
|
3964 | type: "requestfailed",
|
3965 | message: e.failure().errorText,
|
3966 | location: e.url()
|
3967 | }), i) throw new Error(e.failure().errorText);
|
3968 | console.error("requestfailed", e.url());
|
3969 | })), "string" == typeof e.html ? await e2eSetContent(t, e.html, {
|
3970 | waitUntil: e.waitUntil
|
3971 | }) : "string" == typeof e.url ? await e2eGoTo(t, e.url, {
|
3972 | waitUntil: e.waitUntil
|
3973 | }) : (t.goto = e2eGoTo.bind(null, t), t.setContent = e2eSetContent.bind(null, t));
|
3974 | } catch (e) {
|
3975 | throw t && (t.isClosed() || await t.close()), e;
|
3976 | }
|
3977 | return t;
|
3978 | }, exports.newSpecPage = async function newSpecPage(e) {
|
3979 | if (null == e) throw new Error("NewSpecPageOptions required");
|
3980 | testing.resetPlatform(), resetBuildConditionals(appData.BUILD), Array.isArray(e.components) && testing.registerComponents(e.components),
|
3981 | e.hydrateClientSide && (e.includeAnnotations = !0), e.hydrateServerSide ? (e.includeAnnotations = !0,
|
3982 | testing.setSupportsShadowDom(!1)) : (e.includeAnnotations = !!e.includeAnnotations,
|
3983 | !1 === e.supportsShadowDom ? testing.setSupportsShadowDom(!1) : testing.setSupportsShadowDom(!0)),
|
3984 | appData.BUILD.cssAnnotations = e.includeAnnotations;
|
3985 | const t = new Set;
|
3986 | testing.win.__stencil_spec_options = e;
|
3987 | const r = testing.win.document, s = {
|
3988 | win: testing.win,
|
3989 | doc: r,
|
3990 | body: r.body,
|
3991 | build: appData.BUILD,
|
3992 | styles: testing.styles,
|
3993 | setContent: e => (r.body.innerHTML = e, testing.flushAll()),
|
3994 | waitForChanges: testing.flushAll,
|
3995 | flushLoadModule: testing.flushLoadModule,
|
3996 | flushQueue: testing.flushQueue
|
3997 | }, n = e.components.map((e => {
|
3998 | if (null == e.COMPILER_META) throw new Error('Invalid component class: Missing static "COMPILER_META" property.');
|
3999 | t.add(e.COMPILER_META.tagName), e.isProxied = !1, function r(e) {
|
4000 | "function" == typeof e.prototype.__componentWillLoad && (e.prototype.componentWillLoad = e.prototype.__componentWillLoad,
|
4001 | e.prototype.__componentWillLoad = null), "function" == typeof e.prototype.__componentWillUpdate && (e.prototype.componentWillUpdate = e.prototype.__componentWillUpdate,
|
4002 | e.prototype.__componentWillUpdate = null), "function" == typeof e.prototype.__componentWillRender && (e.prototype.componentWillRender = e.prototype.__componentWillRender,
|
4003 | e.prototype.__componentWillRender = null), "function" == typeof e.prototype.componentWillLoad && (e.prototype.__componentWillLoad = e.prototype.componentWillLoad,
|
4004 | e.prototype.componentWillLoad = function() {
|
4005 | const e = this.__componentWillLoad();
|
4006 | return null != e && "function" == typeof e.then ? testing.writeTask((() => e)) : testing.writeTask((() => Promise.resolve())),
|
4007 | e;
|
4008 | }), "function" == typeof e.prototype.componentWillUpdate && (e.prototype.__componentWillUpdate = e.prototype.componentWillUpdate,
|
4009 | e.prototype.componentWillUpdate = function() {
|
4010 | const e = this.__componentWillUpdate();
|
4011 | return null != e && "function" == typeof e.then ? testing.writeTask((() => e)) : testing.writeTask((() => Promise.resolve())),
|
4012 | e;
|
4013 | }), "function" == typeof e.prototype.componentWillRender && (e.prototype.__componentWillRender = e.prototype.componentWillRender,
|
4014 | e.prototype.componentWillRender = function() {
|
4015 | const e = this.__componentWillRender();
|
4016 | return null != e && "function" == typeof e.then ? testing.writeTask((() => e)) : testing.writeTask((() => Promise.resolve())),
|
4017 | e;
|
4018 | });
|
4019 | }(e);
|
4020 | const s = `${e.COMPILER_META.tagName}.${Math.round(899999 * Math.random()) + 1e5}`, n = e.COMPILER_META.styles;
|
4021 | if (Array.isArray(n)) if (n.length > 1) {
|
4022 | const t = {};
|
4023 | n.forEach((e => {
|
4024 | t[e.modeName] = e.styleStr;
|
4025 | })), e.style = t;
|
4026 | } else 1 === n.length && (e.style = n[0].styleStr);
|
4027 | return testing.registerModule(s, e), ((e, t) => [ e, t.map((e => ((e, t) => {
|
4028 | let r = 0;
|
4029 | "shadow" === e.encapsulation ? (r |= 1, e.shadowDelegatesFocus && (r |= 16)) : "scoped" === e.encapsulation && (r |= 2),
|
4030 | "shadow" !== e.encapsulation && e.htmlTagNames.includes("slot") && (r |= 4), e.hasMode && (r |= 32);
|
4031 | const s = formatComponentRuntimeMembers(e, t), n = formatHostListeners(e);
|
4032 | return trimFalsy([ r, e.tagName, Object.keys(s).length > 0 ? s : void 0, n.length > 0 ? n : void 0 ]);
|
4033 | })(e, !0))) ])(s, [ e.COMPILER_META ]);
|
4034 | })), o = (e => {
|
4035 | const t = e.some((e => e.htmlTagNames.includes("slot"))), r = e.some((e => "shadow" === e.encapsulation)), s = e.some((e => "shadow" !== e.encapsulation && e.htmlTagNames.includes("slot"))), n = {
|
4036 | allRenderFn: e.every((e => e.hasRenderFn)),
|
4037 | cmpDidLoad: e.some((e => e.hasComponentDidLoadFn)),
|
4038 | cmpShouldUpdate: e.some((e => e.hasComponentShouldUpdateFn)),
|
4039 | cmpDidUnload: e.some((e => e.hasComponentDidUnloadFn)),
|
4040 | cmpDidUpdate: e.some((e => e.hasComponentDidUpdateFn)),
|
4041 | cmpDidRender: e.some((e => e.hasComponentDidRenderFn)),
|
4042 | cmpWillLoad: e.some((e => e.hasComponentWillLoadFn)),
|
4043 | cmpWillUpdate: e.some((e => e.hasComponentWillUpdateFn)),
|
4044 | cmpWillRender: e.some((e => e.hasComponentWillRenderFn)),
|
4045 | connectedCallback: e.some((e => e.hasConnectedCallbackFn)),
|
4046 | disconnectedCallback: e.some((e => e.hasDisconnectedCallbackFn)),
|
4047 | element: e.some((e => e.hasElement)),
|
4048 | event: e.some((e => e.hasEvent)),
|
4049 | hasRenderFn: e.some((e => e.hasRenderFn)),
|
4050 | lifecycle: e.some((e => e.hasLifecycle)),
|
4051 | asyncLoading: !1,
|
4052 | hostListener: e.some((e => e.hasListener)),
|
4053 | hostListenerTargetWindow: e.some((e => e.hasListenerTargetWindow)),
|
4054 | hostListenerTargetDocument: e.some((e => e.hasListenerTargetDocument)),
|
4055 | hostListenerTargetBody: e.some((e => e.hasListenerTargetBody)),
|
4056 | hostListenerTargetParent: e.some((e => e.hasListenerTargetParent)),
|
4057 | hostListenerTarget: e.some((e => e.hasListenerTarget)),
|
4058 | member: e.some((e => e.hasMember)),
|
4059 | method: e.some((e => e.hasMethod)),
|
4060 | mode: e.some((e => e.hasMode)),
|
4061 | observeAttribute: e.some((e => e.hasAttribute)),
|
4062 | prop: e.some((e => e.hasProp)),
|
4063 | propBoolean: e.some((e => e.hasPropBoolean)),
|
4064 | propNumber: e.some((e => e.hasPropNumber)),
|
4065 | propString: e.some((e => e.hasPropString)),
|
4066 | propMutable: e.some((e => e.hasPropMutable)),
|
4067 | reflect: e.some((e => e.hasReflect)),
|
4068 | scoped: e.some((e => "scoped" === e.encapsulation)),
|
4069 | shadowDom: r,
|
4070 | shadowDelegatesFocus: r && e.some((e => e.shadowDelegatesFocus)),
|
4071 | slot: t,
|
4072 | slotRelocation: s,
|
4073 | state: e.some((e => e.hasState)),
|
4074 | style: e.some((e => e.hasStyle)),
|
4075 | svg: e.some((e => e.htmlTagNames.includes("svg"))),
|
4076 | updatable: e.some((e => e.isUpdateable)),
|
4077 | vdomAttribute: e.some((e => e.hasVdomAttribute)),
|
4078 | vdomXlink: e.some((e => e.hasVdomXlink)),
|
4079 | vdomClass: e.some((e => e.hasVdomClass)),
|
4080 | vdomFunctional: e.some((e => e.hasVdomFunctional)),
|
4081 | vdomKey: e.some((e => e.hasVdomKey)),
|
4082 | vdomListener: e.some((e => e.hasVdomListener)),
|
4083 | vdomPropOrAttr: e.some((e => e.hasVdomPropOrAttr)),
|
4084 | vdomRef: e.some((e => e.hasVdomRef)),
|
4085 | vdomRender: e.some((e => e.hasVdomRender)),
|
4086 | vdomStyle: e.some((e => e.hasVdomStyle)),
|
4087 | vdomText: e.some((e => e.hasVdomText)),
|
4088 | watchCallback: e.some((e => e.hasWatchCallback)),
|
4089 | taskQueue: !0
|
4090 | };
|
4091 | return n.asyncLoading = n.cmpWillUpdate || n.cmpWillLoad || n.cmpWillRender, n.vdomAttribute = n.vdomAttribute || n.reflect,
|
4092 | n.vdomPropOrAttr = n.vdomPropOrAttr || n.reflect, n;
|
4093 | })(e.components.map((e => e.COMPILER_META)));
|
4094 | if (e.strictBuild ? Object.assign(appData.BUILD, o) : Object.keys(o).forEach((e => {
|
4095 | !0 === o[e] && (appData.BUILD[e] = !0);
|
4096 | })), appData.BUILD.asyncLoading = !0, e.hydrateClientSide ? (appData.BUILD.hydrateClientSide = !0,
|
4097 | appData.BUILD.hydrateServerSide = !1) : e.hydrateServerSide && (appData.BUILD.hydrateServerSide = !0,
|
4098 | appData.BUILD.hydrateClientSide = !1), appData.BUILD.cloneNodeFix = !1, appData.BUILD.shadowDomShim = !1,
|
4099 | appData.BUILD.safari10 = !1, appData.BUILD.attachStyles = !!e.attachStyles, "string" == typeof e.url && (s.win.location.href = e.url),
|
4100 | "string" == typeof e.direction && s.doc.documentElement.setAttribute("dir", e.direction),
|
4101 | "string" == typeof e.language && s.doc.documentElement.setAttribute("lang", e.language),
|
4102 | "string" == typeof e.cookie) try {
|
4103 | s.doc.cookie = e.cookie;
|
4104 | } catch (e) {}
|
4105 | if ("string" == typeof e.referrer) try {
|
4106 | s.doc.referrer = e.referrer;
|
4107 | } catch (e) {}
|
4108 | if ("string" == typeof e.userAgent) try {
|
4109 | s.win.navigator.userAgent = e.userAgent;
|
4110 | } catch (e) {}
|
4111 | if (testing.bootstrapLazy(n), "function" == typeof e.template) {
|
4112 | const t = {
|
4113 | $ancestorComponent$: void 0,
|
4114 | $flags$: 0,
|
4115 | $modeName$: void 0,
|
4116 | $cmpMeta$: {
|
4117 | $flags$: 0,
|
4118 | $tagName$: "body"
|
4119 | },
|
4120 | $hostElement$: s.body
|
4121 | };
|
4122 | testing.renderVdom(t, e.template());
|
4123 | } else "string" == typeof e.html && (s.body.innerHTML = e.html);
|
4124 | !1 !== e.flushQueue && await s.waitForChanges();
|
4125 | let i = null;
|
4126 | return Object.defineProperty(s, "root", {
|
4127 | get() {
|
4128 | if (null == i && (i = findRootComponent(t, s.body)), null != i) return i;
|
4129 | const e = s.body.firstElementChild;
|
4130 | return null != e ? e : null;
|
4131 | }
|
4132 | }), Object.defineProperty(s, "rootInstance", {
|
4133 | get() {
|
4134 | const e = testing.getHostRef(s.root);
|
4135 | return null != e ? e.$lazyInstance$ : null;
|
4136 | }
|
4137 | }), e.hydrateServerSide && testing.insertVdomAnnotations(r, []), e.autoApplyChanges && (testing.startAutoApplyChanges(),
|
4138 | s.waitForChanges = () => (console.error('waitForChanges() cannot be used manually if the "startAutoApplyChanges" option is enabled'),
|
4139 | Promise.resolve())), s;
|
4140 | }, exports.shuffleArray = function shuffleArray(e) {
|
4141 | let t, r, s = e.length;
|
4142 | for (;0 !== s; ) r = Math.floor(Math.random() * s), s -= 1, t = e[s], e[s] = e[r],
|
4143 | e[r] = t;
|
4144 | return e;
|
4145 | }, exports.transpile = transpile; |
\ | No newline at end of file |