@stencil/core 2.8.1 → 2.11.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/cli/index.cjs +239 -209
  2. package/cli/index.js +239 -209
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.dom.d.ts +263 -648
  5. package/compiler/lib.dom.iterable.d.ts +1 -5
  6. package/compiler/lib.es2015.core.d.ts +2 -2
  7. package/compiler/lib.es2015.iterable.d.ts +1 -1
  8. package/compiler/lib.es2015.symbol.wellknown.d.ts +10 -10
  9. package/compiler/lib.es2018.asynciterable.d.ts +1 -1
  10. package/compiler/lib.es2020.bigint.d.ts +1 -1
  11. package/compiler/lib.es2020.intl.d.ts +6 -7
  12. package/compiler/lib.es2020.symbol.wellknown.d.ts +1 -1
  13. package/compiler/lib.es2021.d.ts +24 -0
  14. package/compiler/lib.es2021.full.d.ts +25 -0
  15. package/compiler/lib.es2021.promise.d.ts +43 -0
  16. package/compiler/lib.es2021.string.d.ts +35 -0
  17. package/compiler/lib.es2021.weakref.d.ts +75 -0
  18. package/compiler/lib.es5.d.ts +9 -9
  19. package/compiler/lib.esnext.d.ts +1 -4
  20. package/compiler/lib.esnext.promise.d.ts +26 -26
  21. package/compiler/lib.esnext.string.d.ts +18 -18
  22. package/compiler/lib.esnext.weakref.d.ts +58 -58
  23. package/compiler/lib.webworker.d.ts +98 -153
  24. package/compiler/lib.webworker.iterable.d.ts +1 -1
  25. package/compiler/package.json +1 -1
  26. package/compiler/stencil.js +1244 -456
  27. package/compiler/stencil.min.js +2 -2
  28. package/dependencies.json +6 -1
  29. package/dev-server/client/index.js +1 -1
  30. package/dev-server/client/package.json +1 -1
  31. package/dev-server/connector.html +2 -2
  32. package/dev-server/index.js +1 -1
  33. package/dev-server/package.json +1 -1
  34. package/dev-server/server-process.js +2 -2
  35. package/internal/app-data/package.json +1 -1
  36. package/internal/client/css-shim.js +1 -1
  37. package/internal/client/dom.js +1 -1
  38. package/internal/client/index.js +119 -102
  39. package/internal/client/package.json +1 -1
  40. package/internal/client/patch-browser.js +1 -1
  41. package/internal/client/patch-esm.js +1 -1
  42. package/internal/client/shadow-css.js +9 -10
  43. package/internal/hydrate/index.js +44 -40
  44. package/internal/hydrate/package.json +1 -1
  45. package/internal/hydrate/shadow-css.js +59 -62
  46. package/internal/index.js +1 -0
  47. package/internal/package.json +1 -1
  48. package/internal/stencil-private.d.ts +125 -5
  49. package/internal/stencil-public-compiler.d.ts +15 -2
  50. package/internal/testing/index.js +54 -47
  51. package/internal/testing/package.json +1 -1
  52. package/internal/testing/shadow-css.js +54 -57
  53. package/mock-doc/index.cjs +4 -1
  54. package/mock-doc/index.d.ts +7 -6
  55. package/mock-doc/index.js +4 -1
  56. package/mock-doc/package.json +1 -1
  57. package/package.json +16 -6
  58. package/readme.md +2 -2
  59. package/screenshot/index.js +1 -1
  60. package/screenshot/package.json +1 -1
  61. package/sys/node/index.js +4435 -425
  62. package/sys/node/package.json +1 -1
  63. package/sys/node/worker.js +1 -1
  64. package/testing/index.js +23 -18
  65. package/testing/mocks.d.ts +1 -5
  66. package/testing/package.json +1 -1
  67. package/testing/testing-sys.d.ts +6 -1
  68. package/bin/cli.ts +0 -20
  69. package/screenshot/index.js.map +0 -1
  70. package/sys/deno/index.js +0 -1791
  71. package/sys/deno/node-compat.js +0 -2654
  72. package/sys/deno/worker.js +0 -44
package/sys/deno/index.js DELETED
@@ -1,1791 +0,0 @@
1
- /*! Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
2
- * https://github.com/denoland/deno/blob/master/LICENSE
3
- * https://deno.land/ */
4
- function assertPath(e) {
5
- if ("string" != typeof e) throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`);
6
- }
7
-
8
- function isPosixPathSeparator(e) {
9
- return 47 === e;
10
- }
11
-
12
- function isPathSeparator(e) {
13
- return isPosixPathSeparator(e) || 92 === e;
14
- }
15
-
16
- function isWindowsDeviceRoot(e) {
17
- return e >= 97 && e <= 122 || e >= 65 && e <= 90;
18
- }
19
-
20
- function normalizeString(e, t, r, n) {
21
- let o, i = "", a = 0, s = -1, l = 0;
22
- for (let c = 0, h = e.length; c <= h; ++c) {
23
- if (c < h) o = e.charCodeAt(c); else {
24
- if (n(o)) break;
25
- o = 47;
26
- }
27
- if (n(o)) {
28
- if (s === c - 1 || 1 === l) ; else if (s !== c - 1 && 2 === l) {
29
- if (i.length < 2 || 2 !== a || 46 !== i.charCodeAt(i.length - 1) || 46 !== i.charCodeAt(i.length - 2)) {
30
- if (i.length > 2) {
31
- const e = i.lastIndexOf(r);
32
- -1 === e ? (i = "", a = 0) : (i = i.slice(0, e), a = i.length - 1 - i.lastIndexOf(r)),
33
- s = c, l = 0;
34
- continue;
35
- }
36
- if (2 === i.length || 1 === i.length) {
37
- i = "", a = 0, s = c, l = 0;
38
- continue;
39
- }
40
- }
41
- t && (i.length > 0 ? i += `${r}..` : i = "..", a = 2);
42
- } else i.length > 0 ? i += r + e.slice(s + 1, c) : i = e.slice(s + 1, c), a = c - s - 1;
43
- s = c, l = 0;
44
- } else 46 === o && -1 !== l ? ++l : l = -1;
45
- }
46
- return i;
47
- }
48
-
49
- function _format(e, t) {
50
- const r = t.dir || t.root, n = t.base || (t.name || "") + (t.ext || "");
51
- return r ? r === t.root ? r + n : r + e + n : n;
52
- }
53
-
54
- function assert(e, t = "") {
55
- if (!e) throw new DenoStdInternalError(t);
56
- }
57
-
58
- function resolve$2(...e) {
59
- let t = "", r = "", n = !1;
60
- for (let o = e.length - 1; o >= -1; o--) {
61
- let i;
62
- if (o >= 0) i = e[o]; else if (t) {
63
- if (null == globalThis.Deno) throw new TypeError("Resolved a relative path without a CWD.");
64
- i = Deno.env.get(`=${t}`) || Deno.cwd(), void 0 !== i && i.slice(0, 3).toLowerCase() === `${t.toLowerCase()}\\` || (i = `${t}\\`);
65
- } else {
66
- if (null == globalThis.Deno) throw new TypeError("Resolved a drive-letter-less path without a CWD.");
67
- i = Deno.cwd();
68
- }
69
- assertPath(i);
70
- const a = i.length;
71
- if (0 === a) continue;
72
- let s = 0, l = "", c = !1;
73
- const h = i.charCodeAt(0);
74
- if (a > 1) if (isPathSeparator(h)) if (c = !0, isPathSeparator(i.charCodeAt(1))) {
75
- let e = 2, t = e;
76
- for (;e < a && !isPathSeparator(i.charCodeAt(e)); ++e) ;
77
- if (e < a && e !== t) {
78
- const r = i.slice(t, e);
79
- for (t = e; e < a && isPathSeparator(i.charCodeAt(e)); ++e) ;
80
- if (e < a && e !== t) {
81
- for (t = e; e < a && !isPathSeparator(i.charCodeAt(e)); ++e) ;
82
- e === a ? (l = `\\\\${r}\\${i.slice(t)}`, s = e) : e !== t && (l = `\\\\${r}\\${i.slice(t, e)}`,
83
- s = e);
84
- }
85
- }
86
- } else s = 1; else isWindowsDeviceRoot(h) && 58 === i.charCodeAt(1) && (l = i.slice(0, 2),
87
- s = 2, a > 2 && isPathSeparator(i.charCodeAt(2)) && (c = !0, s = 3)); else isPathSeparator(h) && (s = 1,
88
- c = !0);
89
- if (!(l.length > 0 && t.length > 0 && l.toLowerCase() !== t.toLowerCase()) && (0 === t.length && l.length > 0 && (t = l),
90
- n || (r = `${i.slice(s)}\\${r}`, n = c), n && t.length > 0)) break;
91
- }
92
- return r = normalizeString(r, !n, "\\", isPathSeparator), t + (n ? "\\" : "") + r || ".";
93
- }
94
-
95
- function normalize$2(e) {
96
- assertPath(e);
97
- const t = e.length;
98
- if (0 === t) return ".";
99
- let r, n = 0, o = !1;
100
- const i = e.charCodeAt(0);
101
- if (t > 1) if (isPathSeparator(i)) if (o = !0, isPathSeparator(e.charCodeAt(1))) {
102
- let o = 2, i = o;
103
- for (;o < t && !isPathSeparator(e.charCodeAt(o)); ++o) ;
104
- if (o < t && o !== i) {
105
- const a = e.slice(i, o);
106
- for (i = o; o < t && isPathSeparator(e.charCodeAt(o)); ++o) ;
107
- if (o < t && o !== i) {
108
- for (i = o; o < t && !isPathSeparator(e.charCodeAt(o)); ++o) ;
109
- if (o === t) return `\\\\${a}\\${e.slice(i)}\\`;
110
- o !== i && (r = `\\\\${a}\\${e.slice(i, o)}`, n = o);
111
- }
112
- }
113
- } else n = 1; else isWindowsDeviceRoot(i) && 58 === e.charCodeAt(1) && (r = e.slice(0, 2),
114
- n = 2, t > 2 && isPathSeparator(e.charCodeAt(2)) && (o = !0, n = 3)); else if (isPathSeparator(i)) return "\\";
115
- let a;
116
- return a = n < t ? normalizeString(e.slice(n), !o, "\\", isPathSeparator) : "",
117
- 0 !== a.length || o || (a = "."), a.length > 0 && isPathSeparator(e.charCodeAt(t - 1)) && (a += "\\"),
118
- void 0 === r ? o ? a.length > 0 ? `\\${a}` : "\\" : a.length > 0 ? a : "" : o ? a.length > 0 ? `${r}\\${a}` : `${r}\\` : a.length > 0 ? r + a : r;
119
- }
120
-
121
- function resolve$1(...e) {
122
- let t = "", r = !1;
123
- for (let n = e.length - 1; n >= -1 && !r; n--) {
124
- let o;
125
- if (n >= 0) o = e[n]; else {
126
- if (null == globalThis.Deno) throw new TypeError("Resolved a relative path without a CWD.");
127
- o = Deno.cwd();
128
- }
129
- assertPath(o), 0 !== o.length && (t = `${o}/${t}`, r = 47 === o.charCodeAt(0));
130
- }
131
- return t = normalizeString(t, !r, "/", isPosixPathSeparator), r ? t.length > 0 ? `/${t}` : "/" : t.length > 0 ? t : ".";
132
- }
133
-
134
- function normalize$1(e) {
135
- if (assertPath(e), 0 === e.length) return ".";
136
- const t = 47 === e.charCodeAt(0), r = 47 === e.charCodeAt(e.length - 1);
137
- return 0 !== (e = normalizeString(e, !t, "/", isPosixPathSeparator)).length || t || (e = "."),
138
- e.length > 0 && r && (e += "/"), t ? `/${e}` : e;
139
- }
140
-
141
- function globToRegExp(e, {extended: t = !1, globstar: r = !0} = {}) {
142
- const n = function o(e, {extended: t = !1, globstar: r = !1, strict: n = !1, filepath: i = !1, flags: a = ""} = {}) {
143
- function s(e, t = {
144
- split: !1,
145
- last: !1,
146
- only: ""
147
- }) {
148
- const {split: r, last: n, only: o} = t;
149
- "path" !== o && (c += e), i && "regex" !== o && (u += e.match(l) ? SEP : e, r ? (n && (h += e),
150
- "" !== h && (a.includes("g") || (h = `^${h}$`), d.push(new RegExp(h, a))), h = "") : h += e);
151
- }
152
- const l = new RegExp(`^${SEP}${n ? "" : "+"}$`);
153
- let c = "", h = "", u = "";
154
- const d = [];
155
- let f = !1, m = !1;
156
- const g = [];
157
- let p, y;
158
- for (let o = 0; o < e.length; o++) if (p = e[o], y = e[o + 1], [ "\\", "$", "^", ".", "=" ].includes(p)) s(`\\${p}`); else if (p.match(l)) s(SEP, {
159
- split: !0
160
- }), null != y && y.match(l) && !n && (c += "?"); else if ("(" !== p) if (")" !== p) if ("|" !== p) if ("+" !== p) if ("@" === p && t && "(" === y) g.push(p); else if ("!" !== p) if ("?" !== p) if ("[" !== p) if ("]" !== p) if ("{" !== p) if ("}" !== p) if ("," !== p) if ("*" !== p) s(p); else {
161
- if ("(" === y && t) {
162
- g.push(p);
163
- continue;
164
- }
165
- const n = e[o - 1];
166
- let i = 1;
167
- for (;"*" === e[o + 1]; ) i++, o++;
168
- const a = e[o + 1];
169
- r ? i > 1 && [ SEP_RAW, "/", void 0 ].includes(n) && [ SEP_RAW, "/", void 0 ].includes(a) ? (s(GLOBSTAR, {
170
- only: "regex"
171
- }), s(GLOBSTAR_SEGMENT, {
172
- only: "path",
173
- last: !0,
174
- split: !0
175
- }), o++) : (s(WILDCARD, {
176
- only: "regex"
177
- }), s(WILDCARD_SEGMENT, {
178
- only: "path"
179
- })) : s(".*");
180
- } else {
181
- if (f) {
182
- s("|");
183
- continue;
184
- }
185
- s(`\\${p}`);
186
- } else {
187
- if (t) {
188
- f = !1, s(")");
189
- continue;
190
- }
191
- s(`\\${p}`);
192
- } else {
193
- if (t) {
194
- f = !0, s("(?:");
195
- continue;
196
- }
197
- s(`\\${p}`);
198
- } else {
199
- if (t) {
200
- m = !1, s(p);
201
- continue;
202
- }
203
- s(`\\${p}`);
204
- } else {
205
- if (m && ":" === y) {
206
- o++;
207
- let t = "";
208
- for (;":" !== e[++o]; ) t += e[o];
209
- "alnum" === t ? s("(?:\\w|\\d)") : "space" === t ? s("\\s") : "digit" === t && s("\\d"),
210
- o++;
211
- continue;
212
- }
213
- if (t) {
214
- m = !0, s(p);
215
- continue;
216
- }
217
- s(`\\${p}`);
218
- } else {
219
- if (t) {
220
- "(" === y ? g.push(p) : s(".");
221
- continue;
222
- }
223
- s(`\\${p}`);
224
- } else {
225
- if (t) {
226
- if (m) {
227
- s("^");
228
- continue;
229
- }
230
- if ("(" === y) {
231
- g.push(p), s("(?!"), o++;
232
- continue;
233
- }
234
- s(`\\${p}`);
235
- continue;
236
- }
237
- s(`\\${p}`);
238
- } else {
239
- if ("(" === y && t) {
240
- g.push(p);
241
- continue;
242
- }
243
- s(`\\${p}`);
244
- } else {
245
- if (g.length) {
246
- s(p);
247
- continue;
248
- }
249
- s(`\\${p}`);
250
- } else {
251
- if (g.length) {
252
- s(p);
253
- const e = g.pop();
254
- s("@" === e ? "{1}" : "!" === e ? WILDCARD : e);
255
- continue;
256
- }
257
- s(`\\${p}`);
258
- } else {
259
- if (g.length) {
260
- s(`${p}?:`);
261
- continue;
262
- }
263
- s(`\\${p}`);
264
- }
265
- a.includes("g") || (c = `^${c}$`, h = `^${h}$`, i && (u = `^${u}$`));
266
- const w = {
267
- regex: new RegExp(c, a)
268
- };
269
- return i && (d.push(new RegExp(h, a)), w.path = {
270
- regex: new RegExp(u, a),
271
- segments: d,
272
- globstar: new RegExp(a.includes("g") ? GLOBSTAR_SEGMENT : `^${GLOBSTAR_SEGMENT}$`, a)
273
- }), w;
274
- }(e, {
275
- extended: t,
276
- globstar: r,
277
- strict: !1,
278
- filepath: !0
279
- });
280
- return assert(null != n.path), n.path.regex;
281
- }
282
-
283
- function isGlob(e) {
284
- const t = {
285
- "{": "}",
286
- "(": ")",
287
- "[": "]"
288
- }, r = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
289
- if ("" === e) return !1;
290
- let n;
291
- for (;n = r.exec(e); ) {
292
- if (n[2]) return !0;
293
- let r = n.index + n[0].length;
294
- const o = n[1], i = o ? t[o] : null;
295
- if (o && i) {
296
- const t = e.indexOf(i, r);
297
- -1 !== t && (r = t + 1);
298
- }
299
- e = e.slice(r);
300
- }
301
- return !1;
302
- }
303
-
304
- function joinGlobs(e, {extended: t = !1, globstar: r = !1} = {}) {
305
- if (!r || 0 == e.length) return join(...e);
306
- if (0 === e.length) return ".";
307
- let n;
308
- for (const t of e) {
309
- const e = t;
310
- e.length > 0 && (n ? n += `${SEP$1}${e}` : n = e);
311
- }
312
- return n ? function o(e, {globstar: t = !1} = {}) {
313
- if (e.match(/\0/g)) throw new Error(`Glob contains invalid characters: "${e}"`);
314
- if (!t) return normalize(e);
315
- const r = SEP_PATTERN.source, n = new RegExp(`(?<=(${r}|^)\\*\\*${r})\\.\\.(?=${r}|$)`, "g");
316
- return normalize(e.replace(n, "\0")).replace(/\0/g, "..");
317
- }(n, {
318
- extended: t,
319
- globstar: r
320
- }) : ".";
321
- }
322
-
323
- function code(e, t) {
324
- return {
325
- open: `[${e.join(";")}m`,
326
- close: `[${t}m`,
327
- regexp: new RegExp(`\\x1b\\[${t}m`, "g")
328
- };
329
- }
330
-
331
- function run(e, t) {
332
- return enabled ? `${t.open}${e.replace(t.regexp, t.open)}${t.close}` : e;
333
- }
334
-
335
- async function createWalkEntry(e) {
336
- e = normalize(e);
337
- const t = basename(e), r = await Deno.stat(e);
338
- return {
339
- path: e,
340
- name: t,
341
- isFile: r.isFile,
342
- isDirectory: r.isDirectory,
343
- isSymlink: r.isSymlink
344
- };
345
- }
346
-
347
- function include(e, t, r, n) {
348
- return !(t && !t.some((t => e.endsWith(t))) || r && !r.some((t => !!e.match(t))) || n && n.some((t => !!e.match(t))));
349
- }
350
-
351
- async function* walk(e, {maxDepth: t = 1 / 0, includeFiles: r = !0, includeDirs: n = !0, followSymlinks: o = !1, exts: i, match: a, skip: s} = {}) {
352
- if (!(t < 0) && (n && include(e, i, a, s) && (yield await createWalkEntry(e)), !(t < 1) && include(e, void 0, void 0, s))) for await (const l of Deno.readDir(e)) {
353
- if (l.isSymlink) {
354
- if (o) throw new Error("unimplemented");
355
- continue;
356
- }
357
- assert(null != l.name);
358
- const c = join(e, l.name);
359
- l.isFile ? r && include(c, i, a, s) && (yield {
360
- path: c,
361
- ...l
362
- }) : yield* walk(c, {
363
- maxDepth: t - 1,
364
- includeFiles: r,
365
- includeDirs: n,
366
- followSymlinks: o,
367
- exts: i,
368
- match: a,
369
- skip: s
370
- });
371
- }
372
- }
373
-
374
- function throwUnlessNotFound(e) {
375
- if (!(e instanceof Deno.errors.NotFound)) throw e;
376
- }
377
-
378
- function comparePath(e, t) {
379
- return e.path < t.path ? -1 : e.path > t.path ? 1 : 0;
380
- }
381
-
382
- async function denoCopyTasks(e, t, r) {
383
- const n = {
384
- diagnostics: [],
385
- dirPaths: [],
386
- filePaths: []
387
- };
388
- try {
389
- i = await Promise.all(t.map((e => async function t(e, r) {
390
- return isGlob(e.src) ? await async function n(e, t) {
391
- const r = [];
392
- for await (const n of async function* n(e, {root: t = Deno.cwd(), exclude: r = [], includeDirs: o = !0, extended: i = !1, globstar: a = !1} = {}) {
393
- async function* s(e, t) {
394
- if (e.isDirectory) if (".." != t) {
395
- if ("**" == t) return yield* walk(e.path, {
396
- includeFiles: !1,
397
- skip: u
398
- });
399
- yield* walk(e.path, {
400
- maxDepth: 1,
401
- match: [ globToRegExp(joinGlobs([ e.path, t ], l), l) ],
402
- skip: u
403
- });
404
- } else {
405
- const t = joinGlobs([ e.path, ".." ], l);
406
- try {
407
- if ((e => !u.some((t => !!e.match(t))))(t)) return yield await createWalkEntry(t);
408
- } catch (e) {
409
- throwUnlessNotFound(e);
410
- }
411
- }
412
- }
413
- const l = {
414
- extended: i,
415
- globstar: a
416
- }, c = isAbsolute(t) ? normalize(t) : joinGlobs([ Deno.cwd(), t ], l), h = e => isAbsolute(e) ? normalize(e) : joinGlobs([ c, e ], l), u = r.map(h).map((e => globToRegExp(e, l))), {segments: d, hasTrailingSep: f, winRoot: m} = function g(e) {
417
- const t = SEP_PATTERN.source, r = e.replace(new RegExp(`^${t}|${t}$`, "g"), "").split(SEP_PATTERN), n = isAbsolute(e);
418
- return {
419
- segments: r,
420
- isAbsolute: n,
421
- hasTrailingSep: !!e.match(new RegExp(`${t}$`)),
422
- winRoot: isWindows && n ? r.shift() : void 0
423
- };
424
- }(h(e));
425
- let p, y = null != m ? m : "/";
426
- for (;d.length > 0 && !isGlob(d[0]); ) {
427
- const e = d.shift();
428
- assert(null != e), y = joinGlobs([ y, e ], l);
429
- }
430
- try {
431
- p = await createWalkEntry(y);
432
- } catch (e) {
433
- return throwUnlessNotFound(e);
434
- }
435
- let w = [ p ];
436
- for (const e of d) {
437
- const t = new Map;
438
- for (const r of w) for await (const n of s(r, e)) t.set(n.path, n);
439
- w = [ ...t.values() ].sort(comparePath);
440
- }
441
- f && (w = w.filter((e => e.isDirectory))), o || (w = w.filter((e => !e.isDirectory))),
442
- yield* w;
443
- }(e.src, {
444
- root: t
445
- })) {
446
- const o = createGlobCopyTask(e, t, n.name);
447
- r.push(o);
448
- }
449
- return r;
450
- }(e, r) : [ {
451
- src: getSrcAbsPath(r, e.src),
452
- dest: e.keepDirStructure ? join(e.dest, e.src) : e.dest,
453
- warn: e.warn,
454
- keepDirStructure: e.keepDirStructure
455
- } ];
456
- }(e, r)))), t = i.flat ? i.flat(1) : i.reduce(((e, t) => (e.push(...t), e)), []);
457
- const o = [];
458
- for (;t.length > 0; ) {
459
- const r = t.splice(0, 100);
460
- await Promise.all(r.map((t => processCopyTask(e, n, o, t))));
461
- }
462
- const a = function o(e) {
463
- const t = [];
464
- return e.forEach((e => {
465
- !function r(e, t) {
466
- (t = normalizePath(t)) !== ROOT_DIR && t + "/" !== ROOT_DIR && "" !== t && (e.includes(t) || e.push(t));
467
- }(t, dirname(e.dest));
468
- })), t.sort(((e, t) => {
469
- const r = e.split("/").length, n = t.split("/").length;
470
- return r < n ? -1 : r > n ? 1 : e < t ? -1 : e > t ? 1 : 0;
471
- })), t;
472
- }(o);
473
- try {
474
- await Promise.all(a.map((t => e.mkdir(t, {
475
- recursive: !0
476
- }))));
477
- } catch (e) {}
478
- for (;o.length > 0; ) {
479
- const t = o.splice(0, 100);
480
- await Promise.all(t.map((t => e.copyFile(t.src, t.dest))));
481
- }
482
- } catch (e) {
483
- catchError(n.diagnostics, e);
484
- }
485
- var i;
486
- return n;
487
- }
488
-
489
- function getSrcAbsPath(e, t) {
490
- return isAbsolute(t) ? t : join(e, t);
491
- }
492
-
493
- function createGlobCopyTask(e, t, r) {
494
- const n = join(e.dest, e.keepDirStructure ? r : basename(r));
495
- return {
496
- src: join(t, r),
497
- dest: n,
498
- warn: e.warn,
499
- keepDirStructure: e.keepDirStructure
500
- };
501
- }
502
-
503
- async function processCopyTask(e, t, r, n) {
504
- try {
505
- n.src = normalizePath(n.src), n.dest = normalizePath(n.dest), (await e.stat(n.src)).isDirectory ? (t.dirPaths.includes(n.dest) || t.dirPaths.push(n.dest),
506
- await async function o(e, t, r, n) {
507
- try {
508
- for await (const o of e.readDir(n.src)) {
509
- const i = {
510
- src: join(n.src, o.name),
511
- dest: join(n.dest, o.name),
512
- warn: n.warn
513
- };
514
- await processCopyTask(e, t, r, i);
515
- }
516
- } catch (e) {
517
- catchError(t.diagnostics, e);
518
- }
519
- }(e, t, r, n)) : function i(e) {
520
- return e = e.trim().toLowerCase(), IGNORE.some((t => e.endsWith(t)));
521
- }(n.src) || (t.filePaths.includes(n.dest) || t.filePaths.push(n.dest), r.push(n));
522
- } catch (e) {
523
- !1 !== n.warn && (buildError(t.diagnostics).messageText = e.message);
524
- }
525
- }
526
-
527
- function createDenoSys(e = {}) {
528
- let t, r, n, o, i = null, a = new URL("../../compiler/stencil.js", import.meta.url).href;
529
- const s = e.Deno || globalThis.Deno, l = new Set, c = isRemoteUrl(import.meta.url), h = async (e, t, r) => {
530
- try {
531
- return void await s.stat(r);
532
- } catch (e) {}
533
- try {
534
- const n = await fetch(t);
535
- if (n.ok) {
536
- const e = dirname(r);
537
- try {
538
- await s.mkdir(e, {
539
- recursive: !0
540
- });
541
- } catch (e) {}
542
- const t = await n.clone().text(), o = new TextEncoder;
543
- await s.writeFile(r, o.encode(t));
544
- } else buildError(e).messageText = `Unable to fetch: ${t}, ${n.status}`;
545
- } catch (t) {
546
- catchError(e, t);
547
- }
548
- }, u = {
549
- name: "deno",
550
- version: s.version.deno,
551
- async access(e) {
552
- try {
553
- return await s.stat(e), !0;
554
- } catch (e) {
555
- return !1;
556
- }
557
- },
558
- accessSync(e) {
559
- try {
560
- return s.statSync(e), !0;
561
- } catch (e) {
562
- return !1;
563
- }
564
- },
565
- addDestory(e) {
566
- l.add(e);
567
- },
568
- removeDestory(e) {
569
- l.delete(e);
570
- },
571
- async copyFile(e, t) {
572
- try {
573
- return await s.copyFile(e, t), !0;
574
- } catch (e) {
575
- return !1;
576
- }
577
- },
578
- async createDir(e, t) {
579
- const r = {
580
- basename: basename(e),
581
- dirname: dirname(e),
582
- path: e,
583
- newDirs: [],
584
- error: null
585
- };
586
- try {
587
- await s.mkdir(e, t);
588
- } catch (e) {
589
- r.error = e;
590
- }
591
- return r;
592
- },
593
- isTTY() {
594
- var e;
595
- return !!(null == s ? void 0 : s.isatty(null === (e = null == s ? void 0 : s.stdout) || void 0 === e ? void 0 : e.rid));
596
- },
597
- homeDir: () => s.env.get("HOME"),
598
- createDirSync(e, t) {
599
- const r = {
600
- basename: basename(e),
601
- dirname: dirname(e),
602
- path: e,
603
- newDirs: [],
604
- error: null
605
- };
606
- try {
607
- s.mkdirSync(e, t);
608
- } catch (e) {
609
- r.error = e;
610
- }
611
- return r;
612
- },
613
- createWorkerController: e => ((e, t) => {
614
- let r = 0, n = !1, o = !1, i = 0;
615
- const a = new Map, s = [], l = [], c = Math.max(Math.min(t, e.hardwareConcurrency), 2) - 1, h = new Map, u = e => console.error(e), d = () => {
616
- const e = new URL("./worker.js", import.meta.url).href, t = {
617
- name: "stencil.worker." + i++,
618
- type: "module",
619
- deno: !0
620
- }, r = new Worker(e, t), o = {
621
- worker: r,
622
- activeTasks: 0,
623
- sendQueue: []
624
- };
625
- return r.onerror = u, r.onmessage = e => ((e, t) => {
626
- if (!n) {
627
- const r = t.data;
628
- if (Array.isArray(r)) for (const t of r) if (t) {
629
- const r = a.get(t.stencilId);
630
- r ? (a.delete(t.stencilId), t.stencilRtnError ? r.reject(t.stencilRtnError) : r.resolve(t.stencilRtnValue),
631
- e.activeTasks--, (e.activeTasks < 0 || e.activeTasks > 50) && (e.activeTasks = 0)) : t.stencilRtnError && console.error(t.stencilRtnError);
632
- }
633
- }
634
- })(o, e), o;
635
- }, f = e => {
636
- e.sendQueue.length > 0 && (e.worker.postMessage(e.sendQueue), e.sendQueue.length = 0);
637
- }, m = e => {
638
- let t;
639
- if (l.length > 0) {
640
- if (t = l[0], c > 1) {
641
- for (const e of l) e.activeTasks < t.activeTasks && (t = e);
642
- t.activeTasks > 0 && l.length < c && (t = d(), l.push(t));
643
- }
644
- } else t = d(), l.push(t);
645
- t.activeTasks++, t.sendQueue.push(e);
646
- }, g = () => {
647
- o = !1, s.forEach(m), s.length = 0, l.forEach(f);
648
- }, p = (...e) => new Promise(((t, i) => {
649
- if (n) i(TASK_CANCELED_MSG); else {
650
- const n = {
651
- stencilId: r++,
652
- args: e
653
- };
654
- s.push(n), h.set(n.stencilId, Date.now()), a.set(n.stencilId, {
655
- resolve: t,
656
- reject: i
657
- }), o || (o = !0, queueMicrotask(g));
658
- }
659
- }));
660
- return {
661
- send: p,
662
- destroy: () => {
663
- n = !0, a.forEach((e => e.reject(TASK_CANCELED_MSG))), a.clear(), l.forEach((e => e.worker.terminate())),
664
- l.length = 0;
665
- },
666
- handler: e => function(...t) {
667
- return p(e, ...t);
668
- },
669
- maxWorkers: c
670
- };
671
- })(u, e),
672
- async destroy() {
673
- const e = [];
674
- l.forEach((t => {
675
- try {
676
- const r = t();
677
- r && r.then && e.push(r);
678
- } catch (e) {
679
- console.error(`node sys destroy: ${e}`);
680
- }
681
- })), await Promise.all(e), l.clear();
682
- },
683
- dynamicImport: e => (c && (e = (e => (!isString(e) || isRemoteUrl(e) || isFileUrl(e) || (e = isFileUrl(e) ? new URL(e).href : (e = normalizePath(e)).startsWith("/") ? "file://" + e : "file:///" + e),
684
- e))(e)), import(`${e}?2.8.1`)),
685
- encodeToBase64: e => Buffer.from(e).toString("base64"),
686
- async ensureDependencies(e) {
687
- const i = e.logger.createTimeSpan("ensure dependencies start", !0), s = [], l = e.dependencies.find((e => "@stencil/core" === e.name)), c = e.dependencies.find((e => "typescript" === e.name));
688
- r = new URL("../../compiler/stencil.js", import.meta.url).href, isRemoteUrl(r) || (r = u.getRemoteModuleUrl({
689
- moduleId: l.name,
690
- version: l.version,
691
- path: l.main
692
- })), t = new URL("../../", r), a = u.getLocalModulePath({
693
- rootDir: e.rootDir,
694
- moduleId: l.name,
695
- path: l.main
696
- }), n = u.getRemoteModuleUrl({
697
- moduleId: c.name,
698
- version: c.version,
699
- path: c.main
700
- }), o = u.getLocalModulePath({
701
- rootDir: e.rootDir,
702
- moduleId: c.name,
703
- path: c.main
704
- });
705
- const d = h(s, r, a), f = h(s, n, o);
706
- return await Promise.all([ d, f ]), u.getCompilerExecutingPath = () => a, i.finish("ensure dependencies end"),
707
- {
708
- stencilPath: a,
709
- typescriptPath: o,
710
- diagnostics: s
711
- };
712
- },
713
- async ensureResources(e) {
714
- const r = e.dependencies.find((e => "@stencil/core" === e.name)), n = e.dependencies.find((e => "typescript" === e.name)), o = [], i = u.getLocalModulePath({
715
- rootDir: e.rootDir,
716
- moduleId: r.name,
717
- path: "package.json"
718
- }), a = u.getLocalModulePath({
719
- rootDir: e.rootDir,
720
- moduleId: n.name,
721
- path: "package.json"
722
- }), s = u.access(i), l = u.access(a), c = await s, h = await l;
723
- if (c || (e.logger.debug(`stencilBaseUrl: ${t.href}`), r.resources.forEach((n => {
724
- o.push({
725
- url: new URL(n, t).href,
726
- path: u.getLocalModulePath({
727
- rootDir: e.rootDir,
728
- moduleId: r.name,
729
- path: n
730
- })
731
- });
732
- }))), h || n.resources.forEach((t => {
733
- o.push({
734
- url: u.getRemoteModuleUrl({
735
- moduleId: n.name,
736
- version: n.version,
737
- path: t
738
- }),
739
- path: u.getLocalModulePath({
740
- rootDir: e.rootDir,
741
- moduleId: n.name,
742
- path: t
743
- })
744
- });
745
- })), o.length > 0) {
746
- console.log(o);
747
- const t = new Set, r = e.logger.createTimeSpan("ensure resources start", !0);
748
- await Promise.all(o.map((async r => {
749
- const n = await fetch(r.url);
750
- if (n.ok) {
751
- const e = n.text(), o = dirname(r.path);
752
- t.has(o) || (u.createDir(o, {
753
- recursive: !0
754
- }), t.add(o)), await u.writeFile(r.path, await e);
755
- } else e.logger.error(`unable to fetch: ${r.url}`);
756
- }))), r.finish(`ensure resources end: ${o.length}`);
757
- }
758
- },
759
- exit: async e => {
760
- s.exit(e);
761
- },
762
- fetch,
763
- getCompilerExecutingPath: () => a,
764
- getCurrentDirectory: () => normalizePath(s.cwd()),
765
- getEnvironmentVar: e => s.env.get(e),
766
- getLocalModulePath: e => join(e.rootDir, "node_modules", e.moduleId, e.path),
767
- getRemoteModuleUrl: e => {
768
- const t = `${e.moduleId}${e.version ? "@" + e.version : ""}/${e.path}`;
769
- return new URL(t, "https://cdn.jsdelivr.net/npm/").href;
770
- },
771
- glob: (e, t) => null,
772
- hardwareConcurrency: 0,
773
- async isSymbolicLink(e) {
774
- try {
775
- return (await s.stat(e)).isSymlink;
776
- } catch (e) {
777
- return !1;
778
- }
779
- },
780
- nextTick: queueMicrotask,
781
- normalizePath,
782
- platformPath: {
783
- basename,
784
- dirname,
785
- extname,
786
- isAbsolute,
787
- join,
788
- normalize,
789
- parse,
790
- relative,
791
- resolve,
792
- sep,
793
- delimiter,
794
- posix,
795
- win32
796
- },
797
- async readDir(e) {
798
- const t = [];
799
- try {
800
- for await (const r of s.readDir(e)) t.push(join(e, r.name));
801
- } catch (e) {}
802
- return t;
803
- },
804
- readDirSync(e) {
805
- const t = [];
806
- try {
807
- for (const r of s.readDirSync(e)) t.push(join(e, r.name));
808
- } catch (e) {}
809
- return t;
810
- },
811
- async readFile(e, t) {
812
- try {
813
- const r = await s.readFile(e);
814
- return "binary" === t ? r : new TextDecoder("utf-8").decode(r);
815
- } catch (e) {}
816
- },
817
- readFileSync(e) {
818
- try {
819
- const t = new TextDecoder("utf-8"), r = s.readFileSync(e);
820
- return t.decode(r);
821
- } catch (e) {}
822
- },
823
- async realpath(e) {
824
- const t = {
825
- error: null,
826
- path: void 0
827
- };
828
- try {
829
- t.path = await s.realPath(e);
830
- } catch (e) {
831
- t.error = e;
832
- }
833
- return t;
834
- },
835
- realpathSync(e) {
836
- const t = {
837
- error: null,
838
- path: void 0
839
- };
840
- try {
841
- t.path = s.realPathSync(e);
842
- } catch (e) {
843
- t.error = e;
844
- }
845
- return t;
846
- },
847
- async rename(e, t) {
848
- const r = {
849
- oldPath: e,
850
- newPath: t,
851
- error: null,
852
- oldDirs: [],
853
- oldFiles: [],
854
- newDirs: [],
855
- newFiles: [],
856
- renamed: [],
857
- isFile: !1,
858
- isDirectory: !1
859
- };
860
- try {
861
- await s.rename(e, t);
862
- } catch (e) {
863
- r.error = e;
864
- }
865
- return r;
866
- },
867
- resolvePath: e => normalizePath(e),
868
- async removeDir(e, t) {
869
- const r = {
870
- basename: basename(e),
871
- dirname: dirname(e),
872
- path: e,
873
- removedDirs: [],
874
- removedFiles: [],
875
- error: null
876
- };
877
- try {
878
- await s.remove(e, t);
879
- } catch (e) {
880
- r.error = e;
881
- }
882
- return r;
883
- },
884
- removeDirSync(e, t) {
885
- const r = {
886
- basename: basename(e),
887
- dirname: dirname(e),
888
- path: e,
889
- removedDirs: [],
890
- removedFiles: [],
891
- error: null
892
- };
893
- try {
894
- s.removeSync(e, t);
895
- } catch (e) {
896
- r.error = e;
897
- }
898
- return r;
899
- },
900
- async removeFile(e) {
901
- const t = {
902
- basename: basename(e),
903
- dirname: dirname(e),
904
- path: e,
905
- error: null
906
- };
907
- try {
908
- await s.remove(e);
909
- } catch (e) {
910
- t.error = e;
911
- }
912
- return t;
913
- },
914
- removeFileSync(e) {
915
- const t = {
916
- basename: basename(e),
917
- dirname: dirname(e),
918
- path: e,
919
- error: null
920
- };
921
- try {
922
- s.removeSync(e);
923
- } catch (e) {
924
- t.error = e;
925
- }
926
- return t;
927
- },
928
- async stat(e) {
929
- try {
930
- const t = s.statSync(e);
931
- return {
932
- isDirectory: t.isDirectory,
933
- isFile: t.isFile,
934
- isSymbolicLink: t.isSymlink,
935
- size: t.size,
936
- mtimeMs: t.mtime.getTime(),
937
- error: null
938
- };
939
- } catch (e) {
940
- return {
941
- isDirectory: !1,
942
- isFile: !1,
943
- isSymbolicLink: !1,
944
- size: 0,
945
- mtimeMs: 0,
946
- error: e
947
- };
948
- }
949
- },
950
- statSync(e) {
951
- try {
952
- const t = s.statSync(e);
953
- return {
954
- isDirectory: t.isDirectory,
955
- isFile: t.isFile,
956
- isSymbolicLink: t.isSymlink,
957
- size: t.size,
958
- mtimeMs: t.mtime.getTime(),
959
- error: null
960
- };
961
- } catch (e) {
962
- return {
963
- isDirectory: !1,
964
- isFile: !1,
965
- isSymbolicLink: !1,
966
- size: 0,
967
- mtimeMs: 0,
968
- error: e
969
- };
970
- }
971
- },
972
- tmpDirSync: () => (null == i && (i = dirname(s.makeTempDirSync())), i),
973
- async writeFile(e, t) {
974
- const r = {
975
- path: e,
976
- error: null
977
- };
978
- try {
979
- const r = new TextEncoder;
980
- await s.writeFile(e, r.encode(t));
981
- } catch (e) {
982
- r.error = e;
983
- }
984
- return r;
985
- },
986
- writeFileSync(e, t) {
987
- const r = {
988
- path: e,
989
- error: null
990
- };
991
- try {
992
- const r = new TextEncoder;
993
- s.writeFileSync(e, r.encode(t));
994
- } catch (e) {
995
- r.error = e;
996
- }
997
- return r;
998
- },
999
- watchDirectory(e, t, r) {
1000
- const n = s.watchFs(e, {
1001
- recursive: r
1002
- });
1003
- (async () => {
1004
- try {
1005
- for await (const e of n) for (const r of e.paths) {
1006
- const n = normalizePath(r);
1007
- "create" === e.kind ? (t(n, "dirAdd"), u.events.emit("dirAdd", n)) : "modify" === e.kind ? (t(n, "fileUpdate"),
1008
- u.events.emit("fileUpdate", n)) : "remove" === e.kind && (t(n, "dirDelete"), u.events.emit("dirDelete", n));
1009
- }
1010
- } catch (e) {}
1011
- })();
1012
- const o = async () => {
1013
- try {
1014
- await n.return();
1015
- } catch (e) {}
1016
- };
1017
- return u.addDestory(o), {
1018
- close: o
1019
- };
1020
- },
1021
- watchFile(e, t) {
1022
- const r = s.watchFs(e, {
1023
- recursive: !1
1024
- });
1025
- (async () => {
1026
- try {
1027
- for await (const e of r) for (const r of e.paths) {
1028
- const n = normalizePath(r);
1029
- "create" === e.kind ? (t(n, "fileAdd"), u.events.emit("fileAdd", n)) : "modify" === e.kind ? (t(n, "fileUpdate"),
1030
- u.events.emit("fileUpdate", n)) : "remove" === e.kind && (t(n, "fileDelete"), u.events.emit("fileDelete", n));
1031
- }
1032
- } catch (e) {}
1033
- })();
1034
- const n = async () => {
1035
- try {
1036
- await r.return();
1037
- } catch (e) {}
1038
- };
1039
- return u.addDestory(n), {
1040
- close: n
1041
- };
1042
- },
1043
- async generateContentHash(e) {
1044
- const t = e.length;
1045
- if (0 === t) return "";
1046
- let r = 0;
1047
- for (let n = 0; n < t; n++) r = (r << 5) - r + e.charCodeAt(n), r |= 0;
1048
- return r < 0 && (r *= -1), r + "";
1049
- },
1050
- copy: (e, t) => denoCopyTasks(s, e, t),
1051
- details: {
1052
- cpuModel: "cpu-model",
1053
- freemem: () => 0,
1054
- platform: s.build.os,
1055
- release: s.build.vendor,
1056
- totalmem: 0
1057
- },
1058
- applyGlobalPatch: async e => {
1059
- const {applyNodeCompat: t} = await import("./node-compat.js");
1060
- t({
1061
- fromDir: e
1062
- });
1063
- }
1064
- };
1065
- return u;
1066
- }
1067
-
1068
- const createTerminalLogger = e => {
1069
- let t = "info", r = null;
1070
- const n = [], o = e => {
1071
- if (e.length) {
1072
- const t = new Date, r = "[" + ("0" + t.getMinutes()).slice(-2) + ":" + ("0" + t.getSeconds()).slice(-2) + "." + Math.floor(t.getMilliseconds() / 1e3 * 10) + "]";
1073
- e[0] = f(r) + e[0].substr(r.length);
1074
- }
1075
- }, i = e => {
1076
- if (e.length) {
1077
- const t = "[ WARN ]";
1078
- e[0] = d(h(t)) + e[0].substr(t.length);
1079
- }
1080
- }, a = e => {
1081
- if (e.length) {
1082
- const t = "[ ERROR ]";
1083
- e[0] = d(c(t)) + e[0].substr(t.length);
1084
- }
1085
- }, s = e => {
1086
- if (e.length) {
1087
- const t = new Date, r = "[" + ("0" + t.getMinutes()).slice(-2) + ":" + ("0" + t.getSeconds()).slice(-2) + "." + Math.floor(t.getMilliseconds() / 1e3 * 10) + "]";
1088
- e[0] = u(r) + e[0].substr(r.length);
1089
- }
1090
- }, l = (t, o) => {
1091
- if (r) {
1092
- const r = new Date, i = ("0" + r.getHours()).slice(-2) + ":" + ("0" + r.getMinutes()).slice(-2) + ":" + ("0" + r.getSeconds()).slice(-2) + ".0" + Math.floor(r.getMilliseconds() / 1e3 * 10) + " " + ("000" + (e.memoryUsage() / 1e6).toFixed(1)).slice(-6) + "MB " + t + " " + o.join(", ");
1093
- n.push(i);
1094
- }
1095
- }, c = t => e.color(t, "red"), h = t => e.color(t, "yellow"), u = t => e.color(t, "cyan"), d = t => e.color(t, "bold"), f = t => e.color(t, "dim"), m = t => e.color(t, "bgRed"), g = e => LOG_LEVELS.indexOf(e) >= LOG_LEVELS.indexOf(t), p = (t, r, n) => {
1096
- var o, i;
1097
- let a = t.length - r + n - 1;
1098
- for (;t.length + INDENT.length > e.getColumns(); ) if (r > t.length - r + n && r > 5) t = t.substr(1),
1099
- r--; else {
1100
- if (!(a > 1)) break;
1101
- t = t.substr(0, t.length - 1), a--;
1102
- }
1103
- const s = [], l = Math.max(t.length, r + n);
1104
- for (o = 0; o < l; o++) i = t.charAt(o), o >= r && o < r + n && (i = m("" === i ? " " : i)),
1105
- s.push(i);
1106
- return s.join("");
1107
- }, y = e => e.trim().startsWith("//") ? f(e) : e.split(" ").map((e => JS_KEYWORDS.indexOf(e) > -1 ? u(e) : e)).join(" "), w = e => {
1108
- let t = !0;
1109
- const r = [];
1110
- for (var n = 0; n < e.length; n++) {
1111
- const o = e.charAt(n);
1112
- ";" === o || "{" === o ? t = !0 : ".#,:}@$[]/*".indexOf(o) > -1 && (t = !1), t && "abcdefghijklmnopqrstuvwxyz-_".indexOf(o.toLowerCase()) > -1 ? r.push(u(o)) : r.push(o);
1113
- }
1114
- return r.join("");
1115
- };
1116
- return {
1117
- enableColors: e.enableColors,
1118
- emoji: e.emoji,
1119
- getLevel: () => t,
1120
- setLevel: e => t = e,
1121
- debug: (...t) => {
1122
- if (g("debug")) {
1123
- e.memoryUsage() > 0 && t.push(f(` MEM: ${(e.memoryUsage() / 1e6).toFixed(1)}MB`));
1124
- const r = wordWrap(t, e.getColumns());
1125
- s(r), console.log(r.join("\n"));
1126
- }
1127
- l("D", t);
1128
- },
1129
- info: (...t) => {
1130
- if (g("info")) {
1131
- const r = wordWrap(t, e.getColumns());
1132
- o(r), console.log(r.join("\n"));
1133
- }
1134
- l("I", t);
1135
- },
1136
- warn: (...t) => {
1137
- if (g("warn")) {
1138
- const r = wordWrap(t, e.getColumns());
1139
- i(r), console.warn("\n" + r.join("\n") + "\n");
1140
- }
1141
- l("W", t);
1142
- },
1143
- error: (...t) => {
1144
- for (let e = 0; e < t.length; e++) if (t[e] instanceof Error) {
1145
- const r = t[e];
1146
- t[e] = r.message, r.stack && (t[e] += "\n" + r.stack);
1147
- }
1148
- if (g("error")) {
1149
- const r = wordWrap(t, e.getColumns());
1150
- a(r), console.error("\n" + r.join("\n") + "\n");
1151
- }
1152
- l("E", t);
1153
- },
1154
- createTimeSpan: (t, r = !1, n) => {
1155
- const i = Date.now(), a = () => Date.now() - i, c = {
1156
- duration: a,
1157
- finish: (t, i, c, h) => {
1158
- const u = a();
1159
- let m;
1160
- return m = u > 1e3 ? "in " + (u / 1e3).toFixed(2) + " s" : parseFloat(u.toFixed(3)) > 0 ? "in " + u + " ms" : "in less than 1 ms",
1161
- ((t, r, n, i, a, c, h) => {
1162
- let u = t;
1163
- if (n && (u = e.color(t, n)), i && (u = d(u)), u += " " + f(r), c) {
1164
- if (g("debug")) {
1165
- const t = [ u ], r = e.memoryUsage();
1166
- r > 0 && t.push(f(` MEM: ${(r / 1e6).toFixed(1)}MB`));
1167
- const n = wordWrap(t, e.getColumns());
1168
- s(n), console.log(n.join("\n"));
1169
- }
1170
- l("D", [ `${t} ${r}` ]);
1171
- } else {
1172
- const n = wordWrap([ u ], e.getColumns());
1173
- o(n), console.log(n.join("\n")), l("I", [ `${t} ${r}` ]), h && h.push(`${t} ${r}`);
1174
- }
1175
- a && console.log("");
1176
- })(t, m, i, c, h, r, n), u;
1177
- }
1178
- };
1179
- return ((t, r, n) => {
1180
- const i = [ `${t} ${f("...")}` ];
1181
- if (r) {
1182
- if (g("debug")) {
1183
- e.memoryUsage() > 0 && i.push(f(` MEM: ${(e.memoryUsage() / 1e6).toFixed(1)}MB`));
1184
- const r = wordWrap(i, e.getColumns());
1185
- s(r), console.log(r.join("\n")), l("D", [ `${t} ...` ]);
1186
- }
1187
- } else {
1188
- const r = wordWrap(i, e.getColumns());
1189
- o(r), console.log(r.join("\n")), l("I", [ `${t} ...` ]), n && n.push(`${t} ...`);
1190
- }
1191
- })(t, r, n), c;
1192
- },
1193
- printDiagnostics: (r, n) => {
1194
- if (!r || 0 === r.length) return;
1195
- let l = [ "" ];
1196
- r.forEach((r => {
1197
- l = l.concat(((r, n) => {
1198
- const l = wordWrap([ r.messageText ], e.getColumns());
1199
- let c = "";
1200
- r.header && "Build Error" !== r.header && (c += r.header), "string" == typeof r.absFilePath && "string" != typeof r.relFilePath && ("string" != typeof n && (n = e.cwd()),
1201
- r.relFilePath = e.relativePath(n, r.absFilePath), r.relFilePath.includes("/") || (r.relFilePath = "./" + r.relFilePath));
1202
- let d = r.relFilePath;
1203
- return "string" != typeof d && (d = r.absFilePath), "string" == typeof d && (c.length > 0 && (c += ": "),
1204
- c += u(d), "number" == typeof r.lineNumber && r.lineNumber > -1 && (c += f(":"),
1205
- c += h(`${r.lineNumber}`), "number" == typeof r.columnNumber && r.columnNumber > -1 && (c += f(":"),
1206
- c += h(`${r.columnNumber}`)))), c.length > 0 && l.unshift(INDENT + c), l.push(""),
1207
- r.lines && r.lines.length && (prepareLines(r.lines).forEach((e => {
1208
- if (!isMeaningfulLine(e.text)) return;
1209
- let t = "";
1210
- for (e.lineNumber > -1 && (t = `L${e.lineNumber}: `); t.length < INDENT.length; ) t = " " + t;
1211
- let n = e.text;
1212
- e.errorCharStart > -1 && (n = p(n, e.errorCharStart, e.errorLength)), t = f(t),
1213
- "typescript" === r.language || "javascript" === r.language ? t += y(n) : "scss" === r.language || "css" === r.language ? t += w(n) : t += n,
1214
- l.push(t);
1215
- })), l.push("")), "error" === r.level ? a(l) : "warn" === r.level ? i(l) : "debug" === r.level ? s(l) : o(l),
1216
- null != r.debugText && "debug" === t && (l.push(r.debugText), s(wordWrap([ r.debugText ], e.getColumns()))),
1217
- l;
1218
- })(r, n));
1219
- })), console.log(l.join("\n"));
1220
- },
1221
- red: c,
1222
- green: t => e.color(t, "green"),
1223
- yellow: h,
1224
- blue: t => e.color(t, "blue"),
1225
- magenta: t => e.color(t, "magenta"),
1226
- cyan: u,
1227
- gray: t => e.color(t, "gray"),
1228
- bold: d,
1229
- dim: f,
1230
- bgRed: m,
1231
- setLogFilePath: e => r = e,
1232
- writeLogs: t => {
1233
- if (r) try {
1234
- l("F", [ "--------------------------------------" ]), e.writeLogs(r, n.join("\n"), t);
1235
- } catch (e) {}
1236
- n.length = 0;
1237
- }
1238
- };
1239
- }, LOG_LEVELS = [ "debug", "info", "warn", "error" ], wordWrap = (e, t) => {
1240
- const r = [], n = [];
1241
- e.forEach((e => {
1242
- null === e ? n.push("null") : void 0 === e ? n.push("undefined") : "string" == typeof e ? e.replace(/\s/gm, " ").split(" ").forEach((e => {
1243
- e.trim().length && n.push(e.trim());
1244
- })) : "number" == typeof e || "boolean" == typeof e || "function" == typeof e ? n.push(e.toString()) : Array.isArray(e) || Object(e) === e ? n.push((() => e.toString())) : n.push(e.toString());
1245
- }));
1246
- let o = INDENT;
1247
- return n.forEach((e => {
1248
- r.length > 25 || ("function" == typeof e ? (o.trim().length && r.push(o), r.push(e()),
1249
- o = INDENT) : INDENT.length + e.length > t - 1 ? (o.trim().length && r.push(o),
1250
- r.push(INDENT + e), o = INDENT) : e.length + o.length > t - 1 ? (r.push(o), o = INDENT + e + " ") : o += e + " ");
1251
- })), o.trim().length && r.push(o), r.map((e => e.trimRight()));
1252
- }, prepareLines = e => {
1253
- const t = JSON.parse(JSON.stringify(e));
1254
- for (let e = 0; e < 100; e++) {
1255
- if (!eachLineHasLeadingWhitespace(t)) return t;
1256
- for (let e = 0; e < t.length; e++) if (t[e].text = t[e].text.substr(1), t[e].errorCharStart--,
1257
- !t[e].text.length) return t;
1258
- }
1259
- return t;
1260
- }, eachLineHasLeadingWhitespace = e => {
1261
- if (!e.length) return !1;
1262
- for (var t = 0; t < e.length; t++) {
1263
- if (!e[t].text || e[t].text.length < 1) return !1;
1264
- const r = e[t].text.charAt(0);
1265
- if (" " !== r && "\t" !== r) return !1;
1266
- }
1267
- return !0;
1268
- }, isMeaningfulLine = e => !!e && (e = e.trim()).length > 0, JS_KEYWORDS = [ "abstract", "any", "as", "break", "boolean", "case", "catch", "class", "console", "const", "continue", "debugger", "declare", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "from", "function", "get", "if", "import", "in", "implements", "Infinity", "instanceof", "let", "module", "namespace", "NaN", "new", "number", "null", "public", "private", "protected", "require", "return", "static", "set", "string", "super", "switch", "this", "throw", "try", "true", "type", "typeof", "undefined", "var", "void", "with", "while", "yield" ], INDENT = " ", navigator = globalThis.navigator;
1269
-
1270
- let isWindows$1 = !1;
1271
-
1272
- null != globalThis.Deno ? isWindows$1 = "windows" == Deno.build.os : null != (null == navigator ? void 0 : navigator.appVersion) && (isWindows$1 = navigator.appVersion.includes("Win"));
1273
-
1274
- class DenoStdInternalError extends Error {
1275
- constructor(e) {
1276
- super(e), this.name = "DenoStdInternalError";
1277
- }
1278
- }
1279
-
1280
- const _win32 = {
1281
- __proto__: null,
1282
- sep: "\\",
1283
- delimiter: ";",
1284
- resolve: resolve$2,
1285
- normalize: normalize$2,
1286
- isAbsolute: function isAbsolute$2(e) {
1287
- assertPath(e);
1288
- const t = e.length;
1289
- if (0 === t) return !1;
1290
- const r = e.charCodeAt(0);
1291
- return !!isPathSeparator(r) || !!(isWindowsDeviceRoot(r) && t > 2 && 58 === e.charCodeAt(1) && isPathSeparator(e.charCodeAt(2)));
1292
- },
1293
- join: function join$2(...e) {
1294
- const t = e.length;
1295
- if (0 === t) return ".";
1296
- let r, n = null;
1297
- for (let o = 0; o < t; ++o) {
1298
- const t = e[o];
1299
- assertPath(t), t.length > 0 && (void 0 === r ? r = n = t : r += `\\${t}`);
1300
- }
1301
- if (void 0 === r) return ".";
1302
- let o = !0, i = 0;
1303
- if (assert(null != n), isPathSeparator(n.charCodeAt(0))) {
1304
- ++i;
1305
- const e = n.length;
1306
- e > 1 && isPathSeparator(n.charCodeAt(1)) && (++i, e > 2 && (isPathSeparator(n.charCodeAt(2)) ? ++i : o = !1));
1307
- }
1308
- if (o) {
1309
- for (;i < r.length && isPathSeparator(r.charCodeAt(i)); ++i) ;
1310
- i >= 2 && (r = `\\${r.slice(i)}`);
1311
- }
1312
- return normalize$2(r);
1313
- },
1314
- relative: function relative$2(e, t) {
1315
- if (assertPath(e), assertPath(t), e === t) return "";
1316
- const r = resolve$2(e), n = resolve$2(t);
1317
- if (r === n) return "";
1318
- if ((e = r.toLowerCase()) === (t = n.toLowerCase())) return "";
1319
- let o = 0, i = e.length;
1320
- for (;o < i && 92 === e.charCodeAt(o); ++o) ;
1321
- for (;i - 1 > o && 92 === e.charCodeAt(i - 1); --i) ;
1322
- const a = i - o;
1323
- let s = 0, l = t.length;
1324
- for (;s < l && 92 === t.charCodeAt(s); ++s) ;
1325
- for (;l - 1 > s && 92 === t.charCodeAt(l - 1); --l) ;
1326
- const c = l - s, h = a < c ? a : c;
1327
- let u = -1, d = 0;
1328
- for (;d <= h; ++d) {
1329
- if (d === h) {
1330
- if (c > h) {
1331
- if (92 === t.charCodeAt(s + d)) return n.slice(s + d + 1);
1332
- if (2 === d) return n.slice(s + d);
1333
- }
1334
- a > h && (92 === e.charCodeAt(o + d) ? u = d : 2 === d && (u = 3));
1335
- break;
1336
- }
1337
- const r = e.charCodeAt(o + d);
1338
- if (r !== t.charCodeAt(s + d)) break;
1339
- 92 === r && (u = d);
1340
- }
1341
- if (d !== h && -1 === u) return n;
1342
- let f = "";
1343
- for (-1 === u && (u = 0), d = o + u + 1; d <= i; ++d) d !== i && 92 !== e.charCodeAt(d) || (0 === f.length ? f += ".." : f += "\\..");
1344
- return f.length > 0 ? f + n.slice(s + u, l) : (s += u, 92 === n.charCodeAt(s) && ++s,
1345
- n.slice(s, l));
1346
- },
1347
- toNamespacedPath: function toNamespacedPath$2(e) {
1348
- if ("string" != typeof e) return e;
1349
- if (0 === e.length) return "";
1350
- const t = resolve$2(e);
1351
- if (t.length >= 3) if (92 === t.charCodeAt(0)) {
1352
- if (92 === t.charCodeAt(1)) {
1353
- const e = t.charCodeAt(2);
1354
- if (63 !== e && 46 !== e) return `\\\\?\\UNC\\${t.slice(2)}`;
1355
- }
1356
- } else if (isWindowsDeviceRoot(t.charCodeAt(0)) && 58 === t.charCodeAt(1) && 92 === t.charCodeAt(2)) return `\\\\?\\${t}`;
1357
- return e;
1358
- },
1359
- dirname: function dirname$2(e) {
1360
- assertPath(e);
1361
- const t = e.length;
1362
- if (0 === t) return ".";
1363
- let r = -1, n = -1, o = !0, i = 0;
1364
- const a = e.charCodeAt(0);
1365
- if (t > 1) if (isPathSeparator(a)) {
1366
- if (r = i = 1, isPathSeparator(e.charCodeAt(1))) {
1367
- let n = 2, o = n;
1368
- for (;n < t && !isPathSeparator(e.charCodeAt(n)); ++n) ;
1369
- if (n < t && n !== o) {
1370
- for (o = n; n < t && isPathSeparator(e.charCodeAt(n)); ++n) ;
1371
- if (n < t && n !== o) {
1372
- for (o = n; n < t && !isPathSeparator(e.charCodeAt(n)); ++n) ;
1373
- if (n === t) return e;
1374
- n !== o && (r = i = n + 1);
1375
- }
1376
- }
1377
- }
1378
- } else isWindowsDeviceRoot(a) && 58 === e.charCodeAt(1) && (r = i = 2, t > 2 && isPathSeparator(e.charCodeAt(2)) && (r = i = 3)); else if (isPathSeparator(a)) return e;
1379
- for (let r = t - 1; r >= i; --r) if (isPathSeparator(e.charCodeAt(r))) {
1380
- if (!o) {
1381
- n = r;
1382
- break;
1383
- }
1384
- } else o = !1;
1385
- if (-1 === n) {
1386
- if (-1 === r) return ".";
1387
- n = r;
1388
- }
1389
- return e.slice(0, n);
1390
- },
1391
- basename: function basename$2(e, t = "") {
1392
- if (void 0 !== t && "string" != typeof t) throw new TypeError('"ext" argument must be a string');
1393
- assertPath(e);
1394
- let r, n = 0, o = -1, i = !0;
1395
- if (e.length >= 2 && isWindowsDeviceRoot(e.charCodeAt(0)) && 58 === e.charCodeAt(1) && (n = 2),
1396
- void 0 !== t && t.length > 0 && t.length <= e.length) {
1397
- if (t.length === e.length && t === e) return "";
1398
- let a = t.length - 1, s = -1;
1399
- for (r = e.length - 1; r >= n; --r) {
1400
- const l = e.charCodeAt(r);
1401
- if (isPathSeparator(l)) {
1402
- if (!i) {
1403
- n = r + 1;
1404
- break;
1405
- }
1406
- } else -1 === s && (i = !1, s = r + 1), a >= 0 && (l === t.charCodeAt(a) ? -1 == --a && (o = r) : (a = -1,
1407
- o = s));
1408
- }
1409
- return n === o ? o = s : -1 === o && (o = e.length), e.slice(n, o);
1410
- }
1411
- for (r = e.length - 1; r >= n; --r) if (isPathSeparator(e.charCodeAt(r))) {
1412
- if (!i) {
1413
- n = r + 1;
1414
- break;
1415
- }
1416
- } else -1 === o && (i = !1, o = r + 1);
1417
- return -1 === o ? "" : e.slice(n, o);
1418
- },
1419
- extname: function extname$2(e) {
1420
- assertPath(e);
1421
- let t = 0, r = -1, n = 0, o = -1, i = !0, a = 0;
1422
- e.length >= 2 && 58 === e.charCodeAt(1) && isWindowsDeviceRoot(e.charCodeAt(0)) && (t = n = 2);
1423
- for (let s = e.length - 1; s >= t; --s) {
1424
- const t = e.charCodeAt(s);
1425
- if (isPathSeparator(t)) {
1426
- if (!i) {
1427
- n = s + 1;
1428
- break;
1429
- }
1430
- } else -1 === o && (i = !1, o = s + 1), 46 === t ? -1 === r ? r = s : 1 !== a && (a = 1) : -1 !== r && (a = -1);
1431
- }
1432
- return -1 === r || -1 === o || 0 === a || 1 === a && r === o - 1 && r === n + 1 ? "" : e.slice(r, o);
1433
- },
1434
- format: function format$2(e) {
1435
- if (null === e || "object" != typeof e) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
1436
- return _format("\\", e);
1437
- },
1438
- parse: function parse$2(e) {
1439
- assertPath(e);
1440
- const t = {
1441
- root: "",
1442
- dir: "",
1443
- base: "",
1444
- ext: "",
1445
- name: ""
1446
- }, r = e.length;
1447
- if (0 === r) return t;
1448
- let n = 0, o = e.charCodeAt(0);
1449
- if (r > 1) {
1450
- if (isPathSeparator(o)) {
1451
- if (n = 1, isPathSeparator(e.charCodeAt(1))) {
1452
- let t = 2, o = t;
1453
- for (;t < r && !isPathSeparator(e.charCodeAt(t)); ++t) ;
1454
- if (t < r && t !== o) {
1455
- for (o = t; t < r && isPathSeparator(e.charCodeAt(t)); ++t) ;
1456
- if (t < r && t !== o) {
1457
- for (o = t; t < r && !isPathSeparator(e.charCodeAt(t)); ++t) ;
1458
- t === r ? n = t : t !== o && (n = t + 1);
1459
- }
1460
- }
1461
- }
1462
- } else if (isWindowsDeviceRoot(o) && 58 === e.charCodeAt(1)) {
1463
- if (n = 2, !(r > 2)) return t.root = t.dir = e, t;
1464
- if (isPathSeparator(e.charCodeAt(2))) {
1465
- if (3 === r) return t.root = t.dir = e, t;
1466
- n = 3;
1467
- }
1468
- }
1469
- } else if (isPathSeparator(o)) return t.root = t.dir = e, t;
1470
- n > 0 && (t.root = e.slice(0, n));
1471
- let i = -1, a = n, s = -1, l = !0, c = e.length - 1, h = 0;
1472
- for (;c >= n; --c) if (o = e.charCodeAt(c), isPathSeparator(o)) {
1473
- if (!l) {
1474
- a = c + 1;
1475
- break;
1476
- }
1477
- } else -1 === s && (l = !1, s = c + 1), 46 === o ? -1 === i ? i = c : 1 !== h && (h = 1) : -1 !== i && (h = -1);
1478
- return -1 === i || -1 === s || 0 === h || 1 === h && i === s - 1 && i === a + 1 ? -1 !== s && (t.base = t.name = e.slice(a, s)) : (t.name = e.slice(a, i),
1479
- t.base = e.slice(a, s), t.ext = e.slice(i, s)), t.dir = a > 0 && a !== n ? e.slice(0, a - 1) : t.root,
1480
- t;
1481
- },
1482
- fromFileUrl: function fromFileUrl$2(e) {
1483
- if ("file:" != (e = e instanceof URL ? e : new URL(e)).protocol) throw new TypeError("Must be a file URL.");
1484
- let t = decodeURIComponent(e.pathname.replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/").replace(/\//g, "\\"));
1485
- return "" != e.hostname && (t = `\\\\${e.hostname}${t}`), t;
1486
- }
1487
- }, _posix = {
1488
- __proto__: null,
1489
- sep: "/",
1490
- delimiter: ":",
1491
- resolve: resolve$1,
1492
- normalize: normalize$1,
1493
- isAbsolute: function isAbsolute$1(e) {
1494
- return assertPath(e), e.length > 0 && 47 === e.charCodeAt(0);
1495
- },
1496
- join: function join$1(...e) {
1497
- if (0 === e.length) return ".";
1498
- let t;
1499
- for (let r = 0, n = e.length; r < n; ++r) {
1500
- const n = e[r];
1501
- assertPath(n), n.length > 0 && (t ? t += `/${n}` : t = n);
1502
- }
1503
- return t ? normalize$1(t) : ".";
1504
- },
1505
- relative: function relative$1(e, t) {
1506
- if (assertPath(e), assertPath(t), e === t) return "";
1507
- if ((e = resolve$1(e)) === (t = resolve$1(t))) return "";
1508
- let r = 1;
1509
- const n = e.length;
1510
- for (;r < n && 47 === e.charCodeAt(r); ++r) ;
1511
- const o = n - r;
1512
- let i = 1;
1513
- const a = t.length;
1514
- for (;i < a && 47 === t.charCodeAt(i); ++i) ;
1515
- const s = a - i, l = o < s ? o : s;
1516
- let c = -1, h = 0;
1517
- for (;h <= l; ++h) {
1518
- if (h === l) {
1519
- if (s > l) {
1520
- if (47 === t.charCodeAt(i + h)) return t.slice(i + h + 1);
1521
- if (0 === h) return t.slice(i + h);
1522
- } else o > l && (47 === e.charCodeAt(r + h) ? c = h : 0 === h && (c = 0));
1523
- break;
1524
- }
1525
- const n = e.charCodeAt(r + h);
1526
- if (n !== t.charCodeAt(i + h)) break;
1527
- 47 === n && (c = h);
1528
- }
1529
- let u = "";
1530
- for (h = r + c + 1; h <= n; ++h) h !== n && 47 !== e.charCodeAt(h) || (0 === u.length ? u += ".." : u += "/..");
1531
- return u.length > 0 ? u + t.slice(i + c) : (i += c, 47 === t.charCodeAt(i) && ++i,
1532
- t.slice(i));
1533
- },
1534
- toNamespacedPath: function toNamespacedPath$1(e) {
1535
- return e;
1536
- },
1537
- dirname: function dirname$1(e) {
1538
- if (assertPath(e), 0 === e.length) return ".";
1539
- const t = 47 === e.charCodeAt(0);
1540
- let r = -1, n = !0;
1541
- for (let t = e.length - 1; t >= 1; --t) if (47 === e.charCodeAt(t)) {
1542
- if (!n) {
1543
- r = t;
1544
- break;
1545
- }
1546
- } else n = !1;
1547
- return -1 === r ? t ? "/" : "." : t && 1 === r ? "//" : e.slice(0, r);
1548
- },
1549
- basename: function basename$1(e, t = "") {
1550
- if (void 0 !== t && "string" != typeof t) throw new TypeError('"ext" argument must be a string');
1551
- assertPath(e);
1552
- let r, n = 0, o = -1, i = !0;
1553
- if (void 0 !== t && t.length > 0 && t.length <= e.length) {
1554
- if (t.length === e.length && t === e) return "";
1555
- let a = t.length - 1, s = -1;
1556
- for (r = e.length - 1; r >= 0; --r) {
1557
- const l = e.charCodeAt(r);
1558
- if (47 === l) {
1559
- if (!i) {
1560
- n = r + 1;
1561
- break;
1562
- }
1563
- } else -1 === s && (i = !1, s = r + 1), a >= 0 && (l === t.charCodeAt(a) ? -1 == --a && (o = r) : (a = -1,
1564
- o = s));
1565
- }
1566
- return n === o ? o = s : -1 === o && (o = e.length), e.slice(n, o);
1567
- }
1568
- for (r = e.length - 1; r >= 0; --r) if (47 === e.charCodeAt(r)) {
1569
- if (!i) {
1570
- n = r + 1;
1571
- break;
1572
- }
1573
- } else -1 === o && (i = !1, o = r + 1);
1574
- return -1 === o ? "" : e.slice(n, o);
1575
- },
1576
- extname: function extname$1(e) {
1577
- assertPath(e);
1578
- let t = -1, r = 0, n = -1, o = !0, i = 0;
1579
- for (let a = e.length - 1; a >= 0; --a) {
1580
- const s = e.charCodeAt(a);
1581
- if (47 !== s) -1 === n && (o = !1, n = a + 1), 46 === s ? -1 === t ? t = a : 1 !== i && (i = 1) : -1 !== t && (i = -1); else if (!o) {
1582
- r = a + 1;
1583
- break;
1584
- }
1585
- }
1586
- return -1 === t || -1 === n || 0 === i || 1 === i && t === n - 1 && t === r + 1 ? "" : e.slice(t, n);
1587
- },
1588
- format: function format$1(e) {
1589
- if (null === e || "object" != typeof e) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
1590
- return _format("/", e);
1591
- },
1592
- parse: function parse$1(e) {
1593
- assertPath(e);
1594
- const t = {
1595
- root: "",
1596
- dir: "",
1597
- base: "",
1598
- ext: "",
1599
- name: ""
1600
- };
1601
- if (0 === e.length) return t;
1602
- const r = 47 === e.charCodeAt(0);
1603
- let n;
1604
- r ? (t.root = "/", n = 1) : n = 0;
1605
- let o = -1, i = 0, a = -1, s = !0, l = e.length - 1, c = 0;
1606
- for (;l >= n; --l) {
1607
- const t = e.charCodeAt(l);
1608
- if (47 !== t) -1 === a && (s = !1, a = l + 1), 46 === t ? -1 === o ? o = l : 1 !== c && (c = 1) : -1 !== o && (c = -1); else if (!s) {
1609
- i = l + 1;
1610
- break;
1611
- }
1612
- }
1613
- return -1 === o || -1 === a || 0 === c || 1 === c && o === a - 1 && o === i + 1 ? -1 !== a && (t.base = t.name = 0 === i && r ? e.slice(1, a) : e.slice(i, a)) : (0 === i && r ? (t.name = e.slice(1, o),
1614
- t.base = e.slice(1, a)) : (t.name = e.slice(i, o), t.base = e.slice(i, a)), t.ext = e.slice(o, a)),
1615
- i > 0 ? t.dir = e.slice(0, i - 1) : r && (t.dir = "/"), t;
1616
- },
1617
- fromFileUrl: function fromFileUrl$1(e) {
1618
- if ("file:" != (e = e instanceof URL ? e : new URL(e)).protocol) throw new TypeError("Must be a file URL.");
1619
- return decodeURIComponent(e.pathname);
1620
- }
1621
- }, SEP$1 = isWindows$1 ? "\\" : "/", SEP_PATTERN = isWindows$1 ? /[\\/]+/ : /\/+/, SEP = isWindows$1 ? "(?:\\\\|\\/)" : "\\/", SEP_ESC = isWindows$1 ? "\\\\" : "/", SEP_RAW = isWindows$1 ? "\\" : "/", GLOBSTAR = `(?:(?:[^${SEP_ESC}/]*(?:${SEP_ESC}|/|$))*)`, WILDCARD = `(?:[^${SEP_ESC}/]*)`, GLOBSTAR_SEGMENT = `((?:[^${SEP_ESC}/]*(?:${SEP_ESC}|/|$))*)`, WILDCARD_SEGMENT = `(?:[^${SEP_ESC}/]*)`, path = isWindows$1 ? _win32 : _posix, win32 = _win32, posix = _posix, {basename, delimiter, dirname, extname, format, fromFileUrl, isAbsolute, join, normalize, parse, relative, resolve, sep, toNamespacedPath} = path;
1622
-
1623
- var _a, _b;
1624
-
1625
- let enabled = !(null === (_b = null === (_a = globalThis.Deno) || void 0 === _a ? void 0 : _a.noColor) || void 0 === _b || _b);
1626
-
1627
- const isWindows = "windows" == Deno.build.os, createDenoLogger = e => {
1628
- let t = !0;
1629
- const r = e.Deno;
1630
- return createTerminalLogger({
1631
- color: (e, n) => {
1632
- if (t && !r.noColor) switch (n) {
1633
- case "bgRed":
1634
- return function o(e) {
1635
- return run(e, code([ 41 ], 49));
1636
- }(e);
1637
-
1638
- case "blue":
1639
- return function i(e) {
1640
- return run(e, code([ 34 ], 39));
1641
- }(e);
1642
-
1643
- case "bold":
1644
- return function a(e) {
1645
- return run(e, code([ 1 ], 22));
1646
- }(e);
1647
-
1648
- case "cyan":
1649
- return function s(e) {
1650
- return run(e, code([ 36 ], 39));
1651
- }(e);
1652
-
1653
- case "dim":
1654
- return function l(e) {
1655
- return run(e, code([ 2 ], 22));
1656
- }(e);
1657
-
1658
- case "gray":
1659
- return function c(e) {
1660
- return run(e, code([ 90 ], 39));
1661
- }(e);
1662
-
1663
- case "green":
1664
- return function h(e) {
1665
- return run(e, code([ 32 ], 39));
1666
- }(e);
1667
-
1668
- case "magenta":
1669
- return function u(e) {
1670
- return run(e, code([ 35 ], 39));
1671
- }(e);
1672
-
1673
- case "red":
1674
- return function d(e) {
1675
- return run(e, code([ 31 ], 39));
1676
- }(e);
1677
-
1678
- case "yellow":
1679
- return function f(e) {
1680
- return run(e, code([ 33 ], 39));
1681
- }(e);
1682
- }
1683
- return e;
1684
- },
1685
- cwd: () => r.cwd(),
1686
- emoji: e => "windows" !== r.build.os ? e : "",
1687
- enableColors: e => t = e,
1688
- getColumns: () => {
1689
- const e = r.stdout && r.stdout.columns || 80;
1690
- return Math.max(Math.min(120, e), 60);
1691
- },
1692
- memoryUsage: () => -1,
1693
- relativePath: (e, t) => t,
1694
- writeLogs: (e, t, n) => {
1695
- const o = (new TextEncoder).encode(t);
1696
- r.writeFileSync(e, o, {
1697
- append: n
1698
- });
1699
- }
1700
- });
1701
- }, isString = e => "string" == typeof e, buildError = e => {
1702
- const t = {
1703
- level: "error",
1704
- type: "build",
1705
- header: "Build Error",
1706
- messageText: "build error",
1707
- relFilePath: null,
1708
- absFilePath: null,
1709
- lines: []
1710
- };
1711
- return e && e.push(t), t;
1712
- }, catchError = (e, t, r) => {
1713
- const n = {
1714
- level: "error",
1715
- type: "build",
1716
- header: "Build Error",
1717
- messageText: "build error",
1718
- relFilePath: null,
1719
- absFilePath: null,
1720
- lines: []
1721
- };
1722
- return isString(r) ? n.messageText = r : null != t && (null != t.stack ? n.messageText = t.stack.toString() : null != t.message ? n.messageText = t.message.toString() : n.messageText = t.toString()),
1723
- null == e || shouldIgnoreError(n.messageText) || e.push(n), n;
1724
- }, shouldIgnoreError = e => e === TASK_CANCELED_MSG, TASK_CANCELED_MSG = "task canceled", normalizePath = e => {
1725
- if ("string" != typeof e) throw new Error("invalid path to normalize");
1726
- e = normalizeSlashes(e.trim());
1727
- const t = pathComponents(e, getRootLength(e)), r = reducePathComponents(t), n = r[0], o = r[1], i = n + r.slice(1).join("/");
1728
- return "" === i ? "." : "" === n && o && e.includes("/") && !o.startsWith(".") && !o.startsWith("@") ? "./" + i : i;
1729
- }, normalizeSlashes = e => e.replace(backslashRegExp, "/"), backslashRegExp = /\\/g, reducePathComponents = e => {
1730
- if (!Array.isArray(e) || 0 === e.length) return [];
1731
- const t = [ e[0] ];
1732
- for (let r = 1; r < e.length; r++) {
1733
- const n = e[r];
1734
- if (n && "." !== n) {
1735
- if (".." === n) if (t.length > 1) {
1736
- if (".." !== t[t.length - 1]) {
1737
- t.pop();
1738
- continue;
1739
- }
1740
- } else if (t[0]) continue;
1741
- t.push(n);
1742
- }
1743
- }
1744
- return t;
1745
- }, getRootLength = e => {
1746
- const t = getEncodedRootLength(e);
1747
- return t < 0 ? ~t : t;
1748
- }, getEncodedRootLength = e => {
1749
- if (!e) return 0;
1750
- const t = e.charCodeAt(0);
1751
- if (47 === t || 92 === t) {
1752
- if (e.charCodeAt(1) !== t) return 1;
1753
- const r = e.indexOf(47 === t ? "/" : "\\", 2);
1754
- return r < 0 ? e.length : r + 1;
1755
- }
1756
- if (isVolumeCharacter(t) && 58 === e.charCodeAt(1)) {
1757
- const t = e.charCodeAt(2);
1758
- if (47 === t || 92 === t) return 3;
1759
- if (2 === e.length) return 2;
1760
- }
1761
- const r = e.indexOf("://");
1762
- if (-1 !== r) {
1763
- const t = r + "://".length, n = e.indexOf("/", t);
1764
- if (-1 !== n) {
1765
- const o = e.slice(0, r), i = e.slice(t, n);
1766
- if ("file" === o && ("" === i || "localhost" === i) && isVolumeCharacter(e.charCodeAt(n + 1))) {
1767
- const t = getFileUrlVolumeSeparatorEnd(e, n + 2);
1768
- if (-1 !== t) {
1769
- if (47 === e.charCodeAt(t)) return ~(t + 1);
1770
- if (t === e.length) return ~t;
1771
- }
1772
- }
1773
- return ~(n + 1);
1774
- }
1775
- return ~e.length;
1776
- }
1777
- return 0;
1778
- }, isVolumeCharacter = e => e >= 97 && e <= 122 || e >= 65 && e <= 90, getFileUrlVolumeSeparatorEnd = (e, t) => {
1779
- const r = e.charCodeAt(t);
1780
- if (58 === r) return t + 1;
1781
- if (37 === r && 51 === e.charCodeAt(t + 1)) {
1782
- const r = e.charCodeAt(t + 2);
1783
- if (97 === r || 65 === r) return t + 3;
1784
- }
1785
- return -1;
1786
- }, pathComponents = (e, t) => {
1787
- const r = e.substring(0, t), n = e.substring(t).split("/"), o = n.length;
1788
- return o > 0 && !n[o - 1] && n.pop(), [ r, ...n ];
1789
- }, isRemoteUrl = e => !!isString(e) && ((e = e.toLowerCase()).startsWith("https://") || e.startsWith("http://")), isFileUrl = e => !!isString(e) && e.toLowerCase().startsWith("file:/"), ROOT_DIR = normalizePath(resolve("/")), IGNORE = [ ".ds_store", ".gitignore", "desktop.ini", "thumbs.db" ];
1790
-
1791
- export { createDenoLogger, createDenoSys };