valyrian.js 7.2.10 → 7.2.12

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 (64) hide show
  1. package/dist/dataset/index.d.ts +2 -2
  2. package/dist/dataset/index.d.ts.map +1 -1
  3. package/dist/dataset/index.js +21 -21
  4. package/dist/dataset/index.js.map +2 -2
  5. package/dist/dataset/index.mjs +22 -22
  6. package/dist/dataset/index.mjs.map +2 -2
  7. package/dist/hooks/index.d.ts.map +1 -1
  8. package/dist/hooks/index.js +17 -32
  9. package/dist/hooks/index.js.map +3 -3
  10. package/dist/hooks/index.mjs +17 -32
  11. package/dist/hooks/index.mjs.map +3 -3
  12. package/dist/index.d.ts +49 -53
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +378 -326
  15. package/dist/index.js.map +3 -3
  16. package/dist/index.min.js +1 -1
  17. package/dist/index.min.js.map +1 -1
  18. package/dist/index.mjs +378 -326
  19. package/dist/index.mjs.map +3 -3
  20. package/dist/node/index.js +115 -88
  21. package/dist/node/index.js.map +2 -2
  22. package/dist/node/index.mjs +115 -88
  23. package/dist/node/index.mjs.map +2 -2
  24. package/dist/node/utils/tree-adapter.d.ts +5 -0
  25. package/dist/node/utils/tree-adapter.d.ts.map +1 -1
  26. package/dist/proxy-signal/index.js +10 -10
  27. package/dist/proxy-signal/index.js.map +2 -2
  28. package/dist/proxy-signal/index.mjs +10 -10
  29. package/dist/proxy-signal/index.mjs.map +2 -2
  30. package/dist/request/index.js +16 -16
  31. package/dist/request/index.js.map +2 -2
  32. package/dist/request/index.mjs +16 -16
  33. package/dist/request/index.mjs.map +2 -2
  34. package/dist/router/index.d.ts.map +1 -1
  35. package/dist/router/index.js +21 -20
  36. package/dist/router/index.js.map +2 -2
  37. package/dist/router/index.mjs +21 -20
  38. package/dist/router/index.mjs.map +2 -2
  39. package/dist/signal/index.d.ts +7 -18
  40. package/dist/signal/index.d.ts.map +1 -1
  41. package/dist/signal/index.js +29 -48
  42. package/dist/signal/index.js.map +3 -3
  43. package/dist/signal/index.mjs +31 -50
  44. package/dist/signal/index.mjs.map +3 -3
  45. package/dist/store/index.js +2 -2
  46. package/dist/store/index.js.map +2 -2
  47. package/dist/store/index.mjs +2 -2
  48. package/dist/store/index.mjs.map +2 -2
  49. package/lib/dataset/index.ts +25 -25
  50. package/lib/hooks/index.ts +25 -54
  51. package/lib/index.ts +465 -715
  52. package/lib/node/index.ts +2 -2
  53. package/lib/node/utils/icons.ts +5 -5
  54. package/lib/node/utils/inline.ts +17 -17
  55. package/lib/node/utils/sw.ts +3 -3
  56. package/lib/node/utils/tree-adapter.ts +95 -62
  57. package/lib/proxy-signal/index.ts +10 -10
  58. package/lib/request/index.ts +16 -16
  59. package/lib/router/index.ts +21 -20
  60. package/lib/signal/index.ts +56 -131
  61. package/lib/store/index.ts +2 -2
  62. package/package.json +10 -3
  63. package/lib/index.d.ts +0 -0
  64. package/lib/interfaces.ts.bak +0 -141
@@ -48,24 +48,28 @@ var Node = class _Node {
48
48
  constructor() {
49
49
  }
50
50
  appendChild(node) {
51
- node.parentNode && node.parentNode.removeChild(node);
52
- this.childNodes.push(node);
53
- node.parentNode = this;
51
+ if (node) {
52
+ node.parentNode && node.parentNode.removeChild(node);
53
+ this.childNodes.push(node);
54
+ node.parentNode = this;
55
+ }
54
56
  return node;
55
57
  }
56
58
  insertBefore(node, child) {
57
- node.parentNode && node.parentNode.removeChild(node);
58
- node.parentNode = this;
59
- if (child) {
60
- let idx = this.childNodes.indexOf(child);
61
- this.childNodes.splice(idx, 0, node);
62
- } else {
63
- this.childNodes.push(node);
59
+ if (node) {
60
+ node.parentNode && node.parentNode.removeChild(node);
61
+ node.parentNode = this;
62
+ if (child) {
63
+ const idx = this.childNodes.indexOf(child);
64
+ this.childNodes.splice(idx, 0, node);
65
+ } else {
66
+ this.childNodes.push(node);
67
+ }
64
68
  }
65
69
  return node;
66
70
  }
67
71
  replaceChild(node, child) {
68
- if (child && child.parentNode === this) {
72
+ if (node && child && child.parentNode === this) {
69
73
  this.insertBefore(node, child);
70
74
  child.parentNode && child.parentNode.removeChild(child);
71
75
  }
@@ -73,18 +77,21 @@ var Node = class _Node {
73
77
  }
74
78
  removeChild(child) {
75
79
  if (child && child.parentNode === this) {
76
- let idx = this.childNodes.indexOf(child);
80
+ const idx = this.childNodes.indexOf(child);
77
81
  this.childNodes.splice(idx, 1);
78
82
  child.parentNode = null;
79
83
  }
80
84
  return child;
81
85
  }
86
+ remove() {
87
+ return this.parentNode ? this.parentNode.removeChild(this) : this;
88
+ }
82
89
  cloneNode(deep) {
83
90
  if (this.nodeType === 3) {
84
91
  return new Text(this.nodeValue);
85
92
  }
86
93
  if (this.nodeType === 1) {
87
- let node2 = new Element();
94
+ const node2 = new Element();
88
95
  node2.nodeType = this.nodeType;
89
96
  this.nodeName = this.nodeName;
90
97
  if (this.attributes) {
@@ -99,13 +106,13 @@ var Node = class _Node {
99
106
  }
100
107
  return node2;
101
108
  }
102
- let node = new _Node();
109
+ const node = new _Node();
103
110
  node.nodeType = this.nodeType;
104
111
  node.nodeName = this.nodeName;
105
112
  return node;
106
113
  }
107
114
  setAttribute(name, value) {
108
- let attr = {
115
+ const attr = {
109
116
  nodeName: name,
110
117
  nodeValue: value
111
118
  };
@@ -227,8 +234,8 @@ var Text = class extends Node {
227
234
  };
228
235
  function updateElementStyles(element, state) {
229
236
  let str = "";
230
- for (let key in state) {
231
- let value = state[key];
237
+ for (const key in state) {
238
+ const value = state[key];
232
239
  if (typeof value !== "undefined" && value !== null && String(value).length > 0) {
233
240
  str += `${key}: ${state[key]};`;
234
241
  }
@@ -276,26 +283,46 @@ var Element = class extends Node {
276
283
  }
277
284
  throw new Error("Cannot set style");
278
285
  }
286
+ get className() {
287
+ return this.getAttribute("class") || "";
288
+ }
289
+ set className(value) {
290
+ if (value == null || value === false) {
291
+ this.removeAttribute("class");
292
+ } else {
293
+ this.setAttribute("class", String(value));
294
+ }
295
+ }
279
296
  classList = {
280
297
  toggle: (item, force) => {
281
298
  if (item) {
282
- let classes = (this.getAttribute("class") || "").split(" ");
283
- let itemIndex = classes.indexOf(item);
299
+ const classes = (this.className || "").split(" ");
300
+ const itemIndex = classes.indexOf(item);
284
301
  if (force && itemIndex === -1) {
285
302
  classes.push(item);
286
303
  }
287
304
  if (!force && itemIndex !== -1) {
288
305
  classes.splice(itemIndex, 1);
289
306
  }
290
- let final = classes.join(" ").trim();
307
+ const final = classes.join(" ").trim();
291
308
  if (final.length) {
292
- this.setAttribute("class", classes.join(" ").trim());
309
+ this.className = classes.join(" ").trim();
293
310
  } else {
294
- this.removeAttribute("class");
311
+ this.className = false;
295
312
  }
296
313
  }
297
314
  }
298
315
  };
316
+ get id() {
317
+ return this.getAttribute("id") || "";
318
+ }
319
+ set id(value) {
320
+ if (value == null || value === false) {
321
+ this.removeAttribute("id");
322
+ } else {
323
+ this.setAttribute("id", String(value));
324
+ }
325
+ }
299
326
  set textContent(text) {
300
327
  this.nodeValue = String(text);
301
328
  this.childNodes = this.nodeValue ? [new Text(this.nodeValue)] : [];
@@ -318,7 +345,7 @@ var Element = class extends Node {
318
345
  }
319
346
  set innerHTML(html) {
320
347
  this.textContent = "";
321
- let result = htmlToDom(html);
348
+ const result = htmlToDom(html);
322
349
  if (result instanceof DocumentFragment) {
323
350
  for (let i = 0, l = result.childNodes.length; i < l; i++) {
324
351
  this.appendChild(result.childNodes[i]);
@@ -348,12 +375,12 @@ var Document = class extends Element {
348
375
  return new DocumentFragment();
349
376
  }
350
377
  createElement(type) {
351
- let element = new Element();
378
+ const element = new Element();
352
379
  element.nodeName = type.toUpperCase();
353
380
  return element;
354
381
  }
355
382
  createElementNS(ns, type) {
356
- let element = this.createElement(type);
383
+ const element = this.createElement(type);
357
384
  element.baseURI = ns;
358
385
  return element;
359
386
  }
@@ -383,7 +410,7 @@ function domToHtml(dom) {
383
410
  return dom.textContent;
384
411
  }
385
412
  if (dom.nodeType === 1) {
386
- let name = dom.nodeName.toLowerCase();
413
+ const name = dom.nodeName.toLowerCase();
387
414
  let str = "<" + name;
388
415
  for (let i = 0, l = dom.attributes.length; i < l; i++) {
389
416
  str += " " + dom.attributes[i].nodeName + '="' + dom.attributes[i].nodeValue + '"';
@@ -392,7 +419,7 @@ function domToHtml(dom) {
392
419
  str += ">";
393
420
  if (dom.childNodes && dom.childNodes.length > 0) {
394
421
  for (let i = 0, l = dom.childNodes.length; i < l; i++) {
395
- let child = domToHtml(dom.childNodes[i]);
422
+ const child = domToHtml(dom.childNodes[i]);
396
423
  if (child) {
397
424
  str += child;
398
425
  }
@@ -422,9 +449,9 @@ ${spaces}"${item.nodeValue}"`;
422
449
  let str = `
423
450
  ${spaces}v("${item.nodeName}", `;
424
451
  if (item.attributes) {
425
- let attrs = {};
452
+ const attrs = {};
426
453
  for (let i = 0, l = item.attributes.length; i < l; i++) {
427
- let attr = item.attributes[i];
454
+ const attr = item.attributes[i];
428
455
  attrs[attr.nodeName] = attr.nodeValue;
429
456
  }
430
457
  str += JSON.stringify(attrs);
@@ -442,14 +469,14 @@ ${spaces}`;
442
469
  }).join(",");
443
470
  }
444
471
  function findTexts(item, html) {
445
- let newChildren = [];
472
+ const newChildren = [];
446
473
  if (item.children.length) {
447
474
  for (let i = 0; i < item.children.length; i++) {
448
- let child = item.children[i];
449
- let nextChild = item.children[i + 1];
475
+ const child = item.children[i];
476
+ const nextChild = item.children[i + 1];
450
477
  if (i === 0 && child.startsAt > item.contentStartsAt) {
451
- let childContent = html.substring(item.contentStartsAt, child.startsAt);
452
- let childText = {
478
+ const childContent = html.substring(item.contentStartsAt, child.startsAt);
479
+ const childText = {
453
480
  tagName: "#text",
454
481
  startsAt: item.contentStartsAt,
455
482
  endsAt: item.contentStartsAt + childContent.length,
@@ -463,8 +490,8 @@ function findTexts(item, html) {
463
490
  }
464
491
  newChildren.push(child);
465
492
  if (nextChild && child.endsAt < nextChild.startsAt) {
466
- let childContent = html.substring(child.endsAt, nextChild.startsAt);
467
- let childText = {
493
+ const childContent = html.substring(child.endsAt, nextChild.startsAt);
494
+ const childText = {
468
495
  tagName: "#text",
469
496
  startsAt: child.endsAt,
470
497
  endsAt: child.endsAt + childContent.length,
@@ -477,8 +504,8 @@ function findTexts(item, html) {
477
504
  newChildren.push(childText);
478
505
  }
479
506
  if (!nextChild && child.endsAt < item.contentEndsAt) {
480
- let childContent = html.substring(child.endsAt, item.contentEndsAt);
481
- let childText = {
507
+ const childContent = html.substring(child.endsAt, item.contentEndsAt);
508
+ const childText = {
482
509
  tagName: "#text",
483
510
  startsAt: child.endsAt,
484
511
  endsAt: child.endsAt + childContent.length,
@@ -494,9 +521,9 @@ function findTexts(item, html) {
494
521
  }
495
522
  }
496
523
  if (!item.children.length) {
497
- let childContent = html.substring(item.contentStartsAt, item.contentEndsAt);
524
+ const childContent = html.substring(item.contentStartsAt, item.contentEndsAt);
498
525
  if (childContent.length) {
499
- let childText = {
526
+ const childText = {
500
527
  tagName: "#text",
501
528
  startsAt: item.contentStartsAt,
502
529
  endsAt: item.contentEndsAt,
@@ -517,11 +544,11 @@ function convertToDom(item) {
517
544
  node = document.createTextNode(item.nodeValue);
518
545
  } else {
519
546
  node = item.tagName === "#document-fragment" ? document.createDocumentFragment() : document.createElement(item.tagName);
520
- for (let key in item.attributes) {
547
+ for (const key in item.attributes) {
521
548
  node.setAttribute(key, item.attributes[key]);
522
549
  }
523
550
  for (let i = 0; i < item.children.length; i++) {
524
- let child = convertToDom(item.children[i]);
551
+ const child = convertToDom(item.children[i]);
525
552
  node.appendChild(child);
526
553
  }
527
554
  }
@@ -529,24 +556,24 @@ function convertToDom(item) {
529
556
  }
530
557
  function getObjectIndexTree(html) {
531
558
  let item;
532
- let regex = RegExp("<([^>|^!]+)>", "g");
533
- let items = [];
559
+ const regex = RegExp("<([^>|^!]+)>", "g");
560
+ const items = [];
534
561
  while (item = regex.exec(html)) {
535
562
  if (item[0].startsWith("</")) {
536
- let lastOpenedItem = [...items].reverse().find((item2) => item2.endsAt === null);
563
+ const lastOpenedItem = [...items].reverse().find((item2) => item2.endsAt === null);
537
564
  if (lastOpenedItem) {
538
565
  lastOpenedItem.endsAt = item.index + item[0].length;
539
566
  lastOpenedItem.contentEndsAt = item.index;
540
- let parent = [...items].reverse().find((item2) => item2.endsAt === null);
567
+ const parent = [...items].reverse().find((item2) => item2.endsAt === null);
541
568
  if (parent) {
542
- let index = items.indexOf(lastOpenedItem);
569
+ const index = items.indexOf(lastOpenedItem);
543
570
  items.splice(index, 1);
544
571
  parent.children.push(lastOpenedItem);
545
572
  }
546
573
  }
547
574
  continue;
548
575
  }
549
- let element = {
576
+ const element = {
550
577
  tagName: item[1].split(" ")[0],
551
578
  startsAt: item.index,
552
579
  endsAt: null,
@@ -557,9 +584,9 @@ function getObjectIndexTree(html) {
557
584
  nodeValue: null
558
585
  };
559
586
  let string = (item[1] || "").substring(element.tagName.length + 1).replace(/\/$/g, "");
560
- let attributesWithValues = string.match(/\S+="[^"]+"/g);
587
+ const attributesWithValues = string.match(/\S+="[^"]+"/g);
561
588
  if (attributesWithValues) {
562
- for (let attribute of attributesWithValues) {
589
+ for (const attribute of attributesWithValues) {
563
590
  const [name, ...value] = attribute.trim().split("=");
564
591
  string = string.replace(attribute, "");
565
592
  if (value) {
@@ -567,9 +594,9 @@ function getObjectIndexTree(html) {
567
594
  }
568
595
  }
569
596
  }
570
- let attributesWithBooleanValues = string.match(/\s\S+=[^"]+/g);
597
+ const attributesWithBooleanValues = string.match(/\s\S+=[^"]+/g);
571
598
  if (attributesWithBooleanValues) {
572
- for (let attribute of attributesWithBooleanValues) {
599
+ for (const attribute of attributesWithBooleanValues) {
573
600
  const [name, ...value] = attribute.trim().split("=");
574
601
  string = string.replace(attribute, "");
575
602
  if (value) {
@@ -577,9 +604,9 @@ function getObjectIndexTree(html) {
577
604
  }
578
605
  }
579
606
  }
580
- let attributesWithEmptyValues = string.match(/\s?\S+/g);
607
+ const attributesWithEmptyValues = string.match(/\s?\S+/g);
581
608
  if (attributesWithEmptyValues) {
582
- for (let attribute of attributesWithEmptyValues) {
609
+ for (const attribute of attributesWithEmptyValues) {
583
610
  const name = attribute.trim();
584
611
  element.attributes[name] = true;
585
612
  }
@@ -587,7 +614,7 @@ function getObjectIndexTree(html) {
587
614
  if (item[0].endsWith("/>")) {
588
615
  element.endsAt = element.startsAt + item[0].length;
589
616
  element.contentStartsAt = element.contentEndsAt = element.endsAt;
590
- let parent = [...items].reverse().find((item2) => item2.endsAt === null);
617
+ const parent = [...items].reverse().find((item2) => item2.endsAt === null);
591
618
  if (parent) {
592
619
  parent.children.push(element);
593
620
  continue;
@@ -595,7 +622,7 @@ function getObjectIndexTree(html) {
595
622
  }
596
623
  items.push(element);
597
624
  }
598
- let fragmentItem = {
625
+ const fragmentItem = {
599
626
  tagName: "#document-fragment",
600
627
  startsAt: 0,
601
628
  endsAt: html.length,
@@ -610,21 +637,21 @@ function getObjectIndexTree(html) {
610
637
  }
611
638
  function htmlToDom(html) {
612
639
  const openingTag = html.match(/<[^>]+>/g);
613
- let document2 = new Document();
640
+ const document2 = new Document();
614
641
  if (!openingTag) {
615
- let documentFragment = document2.createDocumentFragment();
642
+ const documentFragment = document2.createDocumentFragment();
616
643
  documentFragment.appendChild(document2.createTextNode(html));
617
644
  return documentFragment;
618
645
  }
619
- let fragment = getObjectIndexTree(html);
646
+ const fragment = getObjectIndexTree(html);
620
647
  if (fragment.childNodes.length > 1) {
621
648
  return fragment;
622
649
  }
623
650
  return fragment.childNodes[0];
624
651
  }
625
652
  function htmlToHyperscript(html) {
626
- let domTree = htmlToDom(html);
627
- let hyperscript = domToHyperscript(domTree instanceof DocumentFragment ? domTree.childNodes : [domTree]);
653
+ const domTree = htmlToDom(html);
654
+ const hyperscript = domToHyperscript(domTree instanceof DocumentFragment ? domTree.childNodes : [domTree]);
628
655
  return `[${hyperscript}
629
656
  ]`;
630
657
  }
@@ -637,7 +664,7 @@ import FormData from "form-data";
637
664
  // lib/node/utils/icons.ts
638
665
  import fs from "fs";
639
666
  async function icons(source, configuration) {
640
- let options = {
667
+ const options = {
641
668
  ...icons.options,
642
669
  ...configuration || {}
643
670
  };
@@ -649,17 +676,17 @@ async function icons(source, configuration) {
649
676
  }
650
677
  const { favicons } = await import("favicons");
651
678
  try {
652
- let response = await favicons(source, options);
679
+ const response = await favicons(source, options);
653
680
  if (options.iconsPath) {
654
- for (let i in response.images) {
681
+ for (const i in response.images) {
655
682
  fs.writeFileSync(options.iconsPath + response.images[i].name, response.images[i].contents);
656
683
  }
657
- for (let i in response.files) {
684
+ for (const i in response.files) {
658
685
  fs.writeFileSync(options.iconsPath + response.files[i].name, response.files[i].contents);
659
686
  }
660
687
  }
661
688
  if (options.linksViewPath) {
662
- let html = `
689
+ const html = `
663
690
  function Links(){
664
691
  return ${htmlToHyperscript(response.html.join(""))};
665
692
  }
@@ -714,12 +741,12 @@ import esbuild from "esbuild";
714
741
  import fs2 from "fs";
715
742
  async function inline(file, options = {}) {
716
743
  if (typeof file === "string") {
717
- let ext = file.split(".").pop();
744
+ const ext = file.split(".").pop();
718
745
  if (ext && /(js|cjs|jsx|mjs|ts|tsx)/.test(ext)) {
719
746
  if (/(ts|tsx)/.test(ext) && !options.noValidate) {
720
- let declarationDir = options.declarationDir;
721
- let emitDeclaration = !!declarationDir;
722
- let tscProgOptions = {
747
+ const declarationDir = options.declarationDir;
748
+ const emitDeclaration = !!declarationDir;
749
+ const tscProgOptions = {
723
750
  basePath: process.cwd(),
724
751
  // always required, used for relative paths
725
752
  configFilePath: "tsconfig.json",
@@ -752,7 +779,7 @@ async function inline(file, options = {}) {
752
779
  console.log("tsc", tscProgOptions);
753
780
  tsc.build(tscProgOptions);
754
781
  }
755
- let esbuildOptions = {
782
+ const esbuildOptions = {
756
783
  entryPoints: [file],
757
784
  bundle: "bundle" in options ? options.bundle : true,
758
785
  sourcemap: "external",
@@ -770,13 +797,13 @@ async function inline(file, options = {}) {
770
797
  },
771
798
  ...options.esbuild || {}
772
799
  };
773
- let result = await esbuild.build(esbuildOptions);
800
+ const result = await esbuild.build(esbuildOptions);
774
801
  if (result.outputFiles?.length !== 2) {
775
802
  throw new Error(result.errors.join("\n"));
776
803
  }
777
804
  if (options.compact) {
778
805
  const terser = await import("terser");
779
- let result2 = await terser.minify(result.outputFiles[1].text, {
806
+ const result2 = await terser.minify(result.outputFiles[1].text, {
780
807
  sourceMap: {
781
808
  content: result.outputFiles[0].text.toString()
782
809
  },
@@ -792,16 +819,16 @@ async function inline(file, options = {}) {
792
819
  if (!result2.code || !result2.map) {
793
820
  throw new Error("Unknown error");
794
821
  }
795
- let mapBase64 = Buffer.from(result2.map.toString()).toString("base64");
796
- let suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`;
822
+ const mapBase64 = Buffer.from(result2.map.toString()).toString("base64");
823
+ const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`;
797
824
  return { raw: result2.code, map: suffix, file };
798
825
  } else {
799
- let mapBase64 = Buffer.from(result.outputFiles[0].text.toString()).toString("base64");
800
- let suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`;
826
+ const mapBase64 = Buffer.from(result.outputFiles[0].text.toString()).toString("base64");
827
+ const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`;
801
828
  return { raw: result.outputFiles[1].text, map: suffix, file };
802
829
  }
803
830
  } else if (ext && /(css|scss|styl)/.test(ext)) {
804
- let result = await new CleanCSS({
831
+ const result = await new CleanCSS({
805
832
  sourceMap: true,
806
833
  level: {
807
834
  1: {
@@ -823,15 +850,15 @@ async function inline(file, options = {}) {
823
850
  }
824
851
  }
825
852
  inline.uncss = async function(renderedHtml, css, options = {}) {
826
- let html = await Promise.all(renderedHtml);
827
- let contents = html.map((item) => {
853
+ const html = await Promise.all(renderedHtml);
854
+ const contents = html.map((item) => {
828
855
  return {
829
856
  raw: item,
830
857
  extension: "html"
831
858
  };
832
859
  });
833
- let purgecss = new PurgeCSS();
834
- let output = await purgecss.purge({
860
+ const purgecss = new PurgeCSS();
861
+ const output = await purgecss.purge({
835
862
  fontFace: true,
836
863
  keyframes: true,
837
864
  variables: true,
@@ -840,7 +867,7 @@ inline.uncss = async function(renderedHtml, css, options = {}) {
840
867
  content: contents,
841
868
  css: [{ raw: css }]
842
869
  });
843
- let cleanCss = await new CleanCSS({
870
+ const cleanCss = await new CleanCSS({
844
871
  sourceMap: false,
845
872
  level: {
846
873
  1: {
@@ -860,9 +887,9 @@ inline.uncss = async function(renderedHtml, css, options = {}) {
860
887
  import fs3 from "fs";
861
888
  import path from "path";
862
889
  function sw(file, options = {}) {
863
- let swfiletemplate = path.resolve(__dirname, "./node.sw.tpl");
864
- let swTpl = fs3.readFileSync(swfiletemplate, "utf8");
865
- let opt = Object.assign(
890
+ const swfiletemplate = path.resolve(__dirname, "./node.sw.tpl");
891
+ const swTpl = fs3.readFileSync(swfiletemplate, "utf8");
892
+ const opt = Object.assign(
866
893
  {
867
894
  version: "v1::",
868
895
  name: "Valyrian.js",
@@ -882,8 +909,8 @@ function sw(file, options = {}) {
882
909
  global.FormData = FormData;
883
910
  global.document = document;
884
911
  function render(...args) {
885
- let Component = () => args;
886
- let result = mount("div", Component);
912
+ const Component = () => args;
913
+ const result = mount("div", Component);
887
914
  unmount();
888
915
  return result;
889
916
  }