@stencil/core 2.17.2 → 2.18.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.
- package/cli/index.cjs +32 -16
- package/cli/index.js +32 -16
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +620 -89
- package/compiler/lib.dom.iterable.d.ts +27 -3
- package/compiler/lib.es2015.core.d.ts +3 -3
- package/compiler/lib.es2015.iterable.d.ts +2 -1
- package/compiler/lib.es2015.reflect.d.ts +1 -1
- package/compiler/lib.es2020.bigint.d.ts +7 -5
- package/compiler/lib.es2020.d.ts +2 -0
- package/compiler/lib.es2020.date.d.ts +44 -0
- package/compiler/lib.es2020.intl.d.ts +51 -11
- package/compiler/lib.es2020.number.d.ts +30 -0
- package/compiler/lib.es2021.intl.d.ts +106 -4
- package/compiler/lib.es2022.array.d.ts +123 -0
- package/compiler/lib.es2022.d.ts +26 -0
- package/compiler/lib.es2022.error.d.ts +75 -0
- package/compiler/lib.es2022.full.d.ts +25 -0
- package/compiler/lib.es2022.intl.d.ts +111 -0
- package/compiler/lib.es2022.object.d.ts +28 -0
- package/compiler/lib.es2022.string.d.ts +27 -0
- package/compiler/lib.es5.d.ts +25 -19
- package/compiler/lib.esnext.d.ts +1 -1
- package/compiler/lib.esnext.intl.d.ts +4 -1
- package/compiler/lib.webworker.d.ts +236 -40
- package/compiler/lib.webworker.iterable.d.ts +10 -3
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +689 -232
- package/compiler/stencil.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -0
- package/dependencies.json +10 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +13 -13
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +337 -157
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +2 -106
- package/internal/stencil-public-compiler.d.ts +42 -8
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +77 -61
- package/mock-doc/index.d.ts +13 -12
- package/mock-doc/index.js +77 -61
- package/mock-doc/package.json +1 -1
- package/package.json +5 -7
- package/screenshot/index.js +10 -10
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +96 -106
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/package.json +1 -1
- package/testing/testing-utils.d.ts +5 -4
package/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Testing v2.
|
|
2
|
+
Stencil Testing v2.18.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
function _lazyRequire(e) {
|
|
5
5
|
return new Proxy({}, {
|
|
@@ -524,58 +524,43 @@ function mockCompilerCtx(e) {
|
|
|
524
524
|
return Object.defineProperty(t, "fs", {
|
|
525
525
|
get() {
|
|
526
526
|
return null == this._fs && (this._fs = (e => {
|
|
527
|
-
const t = new Map, r = new Map, s = async e => {
|
|
528
|
-
const t = b(e);
|
|
529
|
-
if ("boolean" == typeof t.exists) return {
|
|
530
|
-
exists: t.exists,
|
|
531
|
-
isDirectory: t.isDirectory,
|
|
532
|
-
isFile: t.isFile
|
|
533
|
-
};
|
|
534
|
-
const r = {
|
|
535
|
-
exists: !1,
|
|
536
|
-
isDirectory: !1,
|
|
537
|
-
isFile: !1
|
|
538
|
-
}, s = await c(e);
|
|
539
|
-
return s ? (t.exists = s.exists, t.isDirectory = s.isDirectory, t.isFile = s.isFile,
|
|
540
|
-
r.exists = t.exists, r.isDirectory = t.isDirectory, r.isFile = t.isFile) : t.exists = !1,
|
|
541
|
-
r;
|
|
542
|
-
}, n = async (e, r = {}) => {
|
|
527
|
+
const t = new Map, r = new Map, s = async (e, r = {}) => {
|
|
543
528
|
e = normalizePath(e);
|
|
544
529
|
const s = [];
|
|
545
530
|
if (!0 === r.inMemoryOnly) {
|
|
546
531
|
let n = e;
|
|
547
532
|
n.endsWith("/") || (n += "/");
|
|
548
|
-
const
|
|
533
|
+
const i = e.split("/");
|
|
549
534
|
t.forEach(((t, n) => {
|
|
550
535
|
if (!n.startsWith(e)) return;
|
|
551
536
|
const a = n.split("/");
|
|
552
|
-
if ((a.length ===
|
|
537
|
+
if ((a.length === i.length + 1 || r.recursive && a.length > i.length) && t.exists) {
|
|
553
538
|
const e = {
|
|
554
539
|
absPath: n,
|
|
555
|
-
relPath: a[
|
|
540
|
+
relPath: a[i.length],
|
|
556
541
|
isDirectory: t.isDirectory,
|
|
557
542
|
isFile: t.isFile
|
|
558
543
|
};
|
|
559
|
-
|
|
544
|
+
o(r, e) || s.push(e);
|
|
560
545
|
}
|
|
561
546
|
}));
|
|
562
|
-
} else await
|
|
547
|
+
} else await n(e, e, r, s);
|
|
563
548
|
return s.sort(((e, t) => e.absPath < t.absPath ? -1 : e.absPath > t.absPath ? 1 : 0));
|
|
564
|
-
},
|
|
549
|
+
}, n = async (t, r, s, i) => {
|
|
565
550
|
const a = await e.readDir(r);
|
|
566
551
|
if (a.length > 0) {
|
|
567
|
-
const e =
|
|
552
|
+
const e = v(r);
|
|
568
553
|
e.exists = !0, e.isFile = !1, e.isDirectory = !0, await Promise.all(a.map((async e => {
|
|
569
|
-
const r = normalizePath(e), a = normalizePath(path$2.relative(t, r)),
|
|
554
|
+
const r = normalizePath(e), a = normalizePath(path$2.relative(t, r)), c = await l(r), u = {
|
|
570
555
|
absPath: r,
|
|
571
556
|
relPath: a,
|
|
572
|
-
isDirectory:
|
|
573
|
-
isFile:
|
|
557
|
+
isDirectory: c.isDirectory,
|
|
558
|
+
isFile: c.isFile
|
|
574
559
|
};
|
|
575
|
-
|
|
560
|
+
o(s, u) || (i.push(u), !0 === s.recursive && !0 === c.isDirectory && await n(t, r, s, i));
|
|
576
561
|
})));
|
|
577
562
|
}
|
|
578
|
-
},
|
|
563
|
+
}, o = (e, t) => {
|
|
579
564
|
if (t.isDirectory) {
|
|
580
565
|
if (Array.isArray(e.excludeDirNames)) {
|
|
581
566
|
const r = path$2.basename(t.absPath);
|
|
@@ -586,20 +571,20 @@ function mockCompilerCtx(e) {
|
|
|
586
571
|
if (e.excludeExtensions.some((e => r.endsWith(e)))) return !0;
|
|
587
572
|
}
|
|
588
573
|
return !1;
|
|
589
|
-
},
|
|
590
|
-
const t =
|
|
574
|
+
}, i = async e => {
|
|
575
|
+
const t = v(e);
|
|
591
576
|
t.isFile = !1, t.isDirectory = !0, t.queueWriteToDisk || (t.queueDeleteFromDisk = !0);
|
|
592
577
|
try {
|
|
593
|
-
const t = await
|
|
578
|
+
const t = await s(e, {
|
|
594
579
|
recursive: !0
|
|
595
580
|
});
|
|
596
|
-
await Promise.all(t.map((e => e.relPath.endsWith(".gitkeep") ? null :
|
|
581
|
+
await Promise.all(t.map((e => e.relPath.endsWith(".gitkeep") ? null : a(e.absPath))));
|
|
597
582
|
} catch (e) {}
|
|
598
|
-
},
|
|
599
|
-
const t =
|
|
583
|
+
}, a = async e => {
|
|
584
|
+
const t = v(e);
|
|
600
585
|
t.queueWriteToDisk || (t.queueDeleteFromDisk = !0);
|
|
601
|
-
},
|
|
602
|
-
const r =
|
|
586
|
+
}, l = async t => {
|
|
587
|
+
const r = v(t);
|
|
603
588
|
if ("boolean" != typeof r.isDirectory || "boolean" != typeof r.isFile) {
|
|
604
589
|
const s = await e.stat(t);
|
|
605
590
|
s.error ? r.exists = !1 : (r.exists = !0, s.isFile ? (r.isFile = !0, r.isDirectory = !1,
|
|
@@ -612,8 +597,8 @@ function mockCompilerCtx(e) {
|
|
|
612
597
|
isDirectory: !!r.isDirectory,
|
|
613
598
|
size: "number" == typeof r.size ? r.size : 0
|
|
614
599
|
};
|
|
615
|
-
},
|
|
616
|
-
const r =
|
|
600
|
+
}, c = t => {
|
|
601
|
+
const r = v(t);
|
|
617
602
|
if ("boolean" != typeof r.isDirectory || "boolean" != typeof r.isFile) {
|
|
618
603
|
const s = e.statSync(t);
|
|
619
604
|
s.error ? r.exists = !1 : (r.exists = !0, s.isFile ? (r.isFile = !0, r.isDirectory = !1,
|
|
@@ -623,9 +608,10 @@ function mockCompilerCtx(e) {
|
|
|
623
608
|
return {
|
|
624
609
|
exists: !!r.exists,
|
|
625
610
|
isFile: !!r.isFile,
|
|
626
|
-
isDirectory: !!r.isDirectory
|
|
611
|
+
isDirectory: !!r.isDirectory,
|
|
612
|
+
size: r.size
|
|
627
613
|
};
|
|
628
|
-
},
|
|
614
|
+
}, u = async (t, s, n) => {
|
|
629
615
|
if ("string" != typeof t) throw new Error(`writeFile, invalid filePath: ${t}`);
|
|
630
616
|
if ("string" != typeof s) throw new Error(`writeFile, invalid content: ${t}`);
|
|
631
617
|
const o = {
|
|
@@ -634,60 +620,60 @@ function mockCompilerCtx(e) {
|
|
|
634
620
|
queuedWrite: !1
|
|
635
621
|
};
|
|
636
622
|
if (!0 === shouldIgnore(t)) return o.ignored = !0, o;
|
|
637
|
-
const i =
|
|
623
|
+
const i = v(t);
|
|
638
624
|
if (i.exists = !0, i.isFile = !0, i.isDirectory = !1, i.queueDeleteFromDisk = !1,
|
|
639
625
|
"string" == typeof i.fileText ? o.changedContent = i.fileText.replace(/\r/g, "") !== s.replace(/\r/g, "") : o.changedContent = !0,
|
|
640
626
|
i.fileText = s, o.queuedWrite = !1, null != n && ("string" == typeof n.outputTargetType && r.set(t, n.outputTargetType),
|
|
641
627
|
!1 === n.useCache && (i.useCache = !1)), null != n && !0 === n.inMemoryOnly) i.queueWriteToDisk ? o.queuedWrite = !0 : i.queueWriteToDisk = !1,
|
|
642
|
-
await
|
|
628
|
+
await d(t, !0); else if (null != n && !0 === n.immediateWrite) {
|
|
643
629
|
if (o.changedContent || !0 !== n.useCache) {
|
|
644
630
|
const r = await e.readFile(t);
|
|
645
631
|
"string" == typeof r && (o.changedContent = i.fileText.replace(/\r/g, "") !== r.replace(/\r/g, "")),
|
|
646
|
-
o.changedContent && (await
|
|
632
|
+
o.changedContent && (await d(t, !1), await e.writeFile(t, i.fileText));
|
|
647
633
|
}
|
|
648
634
|
} else i.queueWriteToDisk || !0 !== o.changedContent || (i.queueWriteToDisk = !0,
|
|
649
635
|
o.queuedWrite = !0);
|
|
650
636
|
return o;
|
|
651
|
-
},
|
|
637
|
+
}, d = async (e, t) => {
|
|
652
638
|
const r = [];
|
|
653
639
|
for (;"string" == typeof (e = path$2.dirname(e)) && e.length > 0 && "/" !== e && !1 === e.endsWith(":/") && !1 === e.endsWith(":\\"); ) r.push(e);
|
|
654
|
-
r.reverse(), await
|
|
655
|
-
},
|
|
640
|
+
r.reverse(), await h(r, t);
|
|
641
|
+
}, h = async (t, r) => {
|
|
656
642
|
const s = [];
|
|
657
643
|
for (const n of t) {
|
|
658
|
-
const t =
|
|
644
|
+
const t = v(n);
|
|
659
645
|
if (!0 !== t.exists || !0 !== t.isDirectory) try {
|
|
660
646
|
t.exists = !0, t.isDirectory = !0, t.isFile = !1, r || await e.createDir(n), s.push(n);
|
|
661
647
|
} catch (e) {}
|
|
662
648
|
}
|
|
663
649
|
return s;
|
|
664
|
-
},
|
|
665
|
-
const r
|
|
650
|
+
}, p = t => Promise.all(t.map((async t => {
|
|
651
|
+
const [r, s] = t;
|
|
666
652
|
return await e.copyFile(r, s), [ r, s ];
|
|
667
|
-
}))),
|
|
653
|
+
}))), f = e => Promise.all(e.map((async e => {
|
|
668
654
|
if ("string" != typeof e) throw new Error("unable to writeFile without filePath");
|
|
669
|
-
return
|
|
670
|
-
}))),
|
|
671
|
-
const r =
|
|
655
|
+
return m(e);
|
|
656
|
+
}))), m = async t => {
|
|
657
|
+
const r = v(t);
|
|
672
658
|
if (null == r.fileText) throw new Error(`unable to find item fileText to write: ${t}`);
|
|
673
|
-
return await e.writeFile(t, r.fileText), !1 === r.useCache &&
|
|
674
|
-
},
|
|
659
|
+
return await e.writeFile(t, r.fileText), !1 === r.useCache && _(t), t;
|
|
660
|
+
}, g = async t => await Promise.all(t.map((async t => {
|
|
675
661
|
if ("string" != typeof t) throw new Error("unable to unlink without filePath");
|
|
676
662
|
return await e.removeFile(t), t;
|
|
677
|
-
}))),
|
|
663
|
+
}))), y = async t => {
|
|
678
664
|
const r = [];
|
|
679
665
|
for (const s of t) await e.removeDir(s), r.push(s);
|
|
680
666
|
return r;
|
|
681
|
-
},
|
|
667
|
+
}, w = e => {
|
|
682
668
|
e = normalizePath(e), t.forEach(((t, r) => {
|
|
683
669
|
const s = path$2.relative(e, r).split("/")[0];
|
|
684
|
-
s.startsWith(".") || s.startsWith("/") ||
|
|
670
|
+
s.startsWith(".") || s.startsWith("/") || _(r);
|
|
685
671
|
}));
|
|
686
|
-
},
|
|
672
|
+
}, _ = e => {
|
|
687
673
|
e = normalizePath(e);
|
|
688
674
|
const r = t.get(e);
|
|
689
675
|
null == r || r.queueWriteToDisk || t.delete(e);
|
|
690
|
-
},
|
|
676
|
+
}, v = e => {
|
|
691
677
|
e = normalizePath(e);
|
|
692
678
|
let r = t.get(e);
|
|
693
679
|
return null != r || t.set(e, r = {
|
|
@@ -702,36 +688,36 @@ function mockCompilerCtx(e) {
|
|
|
702
688
|
queueWriteToDisk: null,
|
|
703
689
|
useCache: null
|
|
704
690
|
}), r;
|
|
705
|
-
},
|
|
691
|
+
}, b = 5242880;
|
|
706
692
|
return {
|
|
707
|
-
access: async e =>
|
|
693
|
+
access: async e => {
|
|
694
|
+
const t = v(e);
|
|
695
|
+
return "boolean" != typeof t.exists ? (await l(e)).exists : t.exists;
|
|
696
|
+
},
|
|
708
697
|
accessSync: e => {
|
|
709
|
-
const t =
|
|
710
|
-
|
|
711
|
-
const r = u(e);
|
|
712
|
-
t.exists = r.exists, t.isDirectory = r.isDirectory, t.isFile = r.isFile;
|
|
713
|
-
}
|
|
714
|
-
return t.exists;
|
|
698
|
+
const t = v(e);
|
|
699
|
+
return "boolean" != typeof t.exists ? c(e).exists : t.exists;
|
|
715
700
|
},
|
|
716
|
-
accessData: s,
|
|
717
701
|
cancelDeleteDirectoriesFromDisk: e => {
|
|
718
702
|
for (const t of e) {
|
|
719
|
-
const e =
|
|
703
|
+
const e = v(t);
|
|
720
704
|
!0 === e.queueDeleteFromDisk && (e.queueDeleteFromDisk = !1);
|
|
721
705
|
}
|
|
722
706
|
},
|
|
723
707
|
cancelDeleteFilesFromDisk: e => {
|
|
724
708
|
for (const t of e) {
|
|
725
|
-
const e =
|
|
709
|
+
const e = v(t);
|
|
726
710
|
!0 === e.isFile && !0 === e.queueDeleteFromDisk && (e.queueDeleteFromDisk = !1);
|
|
727
711
|
}
|
|
728
712
|
},
|
|
729
|
-
clearCache: () =>
|
|
730
|
-
|
|
731
|
-
|
|
713
|
+
clearCache: () => {
|
|
714
|
+
t.clear();
|
|
715
|
+
},
|
|
716
|
+
clearDirCache: w,
|
|
717
|
+
clearFileCache: _,
|
|
732
718
|
commit: async () => {
|
|
733
|
-
const e = getCommitInstructions(t), r = await
|
|
734
|
-
return e.filesToDelete.forEach(
|
|
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), {
|
|
735
721
|
filesCopied: n,
|
|
736
722
|
filesWritten: s,
|
|
737
723
|
filesDeleted: o,
|
|
@@ -740,20 +726,20 @@ function mockCompilerCtx(e) {
|
|
|
740
726
|
};
|
|
741
727
|
},
|
|
742
728
|
copyFile: async (e, t) => {
|
|
743
|
-
|
|
729
|
+
v(e).queueCopyFileToDest = t;
|
|
744
730
|
},
|
|
745
731
|
emptyDirs: async e => {
|
|
746
732
|
e = e.filter(isString).map(normalizePath).reduce(((e, t) => (e.includes(t) || e.push(t),
|
|
747
733
|
e)), []);
|
|
748
|
-
const t = await Promise.all(e.map((e =>
|
|
734
|
+
const t = await Promise.all(e.map((e => s(e, {
|
|
749
735
|
recursive: !0
|
|
750
736
|
})))), r = [];
|
|
751
737
|
for (const e of t) for (const t of e) r.includes(t.absPath) || r.push(t.absPath);
|
|
752
738
|
r.sort(((e, t) => {
|
|
753
739
|
const r = e.split("/").length, s = t.split("/").length;
|
|
754
740
|
return r < s ? 1 : r > s ? -1 : 0;
|
|
755
|
-
})), await Promise.all(r.map(
|
|
756
|
-
const t =
|
|
741
|
+
})), await Promise.all(r.map(a)), e.forEach((e => {
|
|
742
|
+
const t = v(e);
|
|
757
743
|
t.isFile = !1, t.isDirectory = !0, t.queueWriteToDisk = !0, t.queueDeleteFromDisk = !1;
|
|
758
744
|
}));
|
|
759
745
|
},
|
|
@@ -767,42 +753,41 @@ function mockCompilerCtx(e) {
|
|
|
767
753
|
});
|
|
768
754
|
})), e.forEach((e => e.files.sort())), e.sort(((e, t) => e.type < t.type ? -1 : e.type > t.type ? 1 : 0));
|
|
769
755
|
},
|
|
770
|
-
getItem:
|
|
756
|
+
getItem: v,
|
|
771
757
|
getMemoryStats: () => `data length: ${t.size}`,
|
|
772
|
-
keys: () => Array.from(t.keys()).sort(),
|
|
773
758
|
readFile: async (t, r) => {
|
|
774
759
|
if (null == r || !0 === r.useCache || void 0 === r.useCache) {
|
|
775
|
-
const e =
|
|
760
|
+
const e = v(t);
|
|
776
761
|
if (e.exists && "string" == typeof e.fileText) return e.fileText;
|
|
777
762
|
}
|
|
778
|
-
const s = await e.readFile(t), n =
|
|
779
|
-
return "string" == typeof s ? s.length <
|
|
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,
|
|
780
765
|
n.fileText = s) : n.exists = !1, s;
|
|
781
766
|
},
|
|
782
767
|
readFileSync: (t, r) => {
|
|
783
768
|
if (null == r || !0 === r.useCache || void 0 === r.useCache) {
|
|
784
|
-
const e =
|
|
769
|
+
const e = v(t);
|
|
785
770
|
if (e.exists && "string" == typeof e.fileText) return e.fileText;
|
|
786
771
|
}
|
|
787
|
-
const s = e.readFileSync(t), n =
|
|
788
|
-
return "string" == typeof s ? s.length <
|
|
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,
|
|
789
774
|
n.fileText = s) : n.exists = !1, s;
|
|
790
775
|
},
|
|
791
|
-
readdir:
|
|
776
|
+
readdir: s,
|
|
792
777
|
remove: async e => {
|
|
793
|
-
const t = await
|
|
794
|
-
!0 === t.isDirectory ? await
|
|
778
|
+
const t = await l(e);
|
|
779
|
+
!0 === t.isDirectory ? await i(e) : !0 === t.isFile && await a(e);
|
|
795
780
|
},
|
|
796
|
-
stat:
|
|
797
|
-
statSync:
|
|
781
|
+
stat: l,
|
|
782
|
+
statSync: c,
|
|
798
783
|
sys: e,
|
|
799
|
-
writeFile:
|
|
784
|
+
writeFile: u,
|
|
800
785
|
writeFiles: (e, t) => {
|
|
801
786
|
const r = [];
|
|
802
787
|
return isIterable(e) ? e.forEach(((e, s) => {
|
|
803
|
-
r.push(
|
|
788
|
+
r.push(u(s, e, t));
|
|
804
789
|
})) : Object.keys(e).map((s => {
|
|
805
|
-
r.push(
|
|
790
|
+
r.push(u(s, e[s], t));
|
|
806
791
|
})), Promise.all(r);
|
|
807
792
|
}
|
|
808
793
|
};
|
|
@@ -1323,21 +1308,23 @@ const path$2 = require("path"), index_js = _lazyRequire("../dev-server/index.js"
|
|
|
1323
1308
|
if (!r.includes(t.code) && (n = t.messageText, isIterable(t.next))) for (const r of t.next) n += flattenDiagnosticMessageText(e, r);
|
|
1324
1309
|
return s && (n = n.replace("type 'StencilConfig'", "Stencil Config"), n = n.replace("Object literal may only specify known properties, but ", ""),
|
|
1325
1310
|
n = n.replace("Object literal may only specify known properties, and ", "")), n.trim();
|
|
1326
|
-
}, isOutputTargetDistLazy = e => e.type === DIST_LAZY, isOutputTargetWww = e => e.type === WWW, DIST_LAZY = "dist-lazy", WWW = "www", isJest27TransformOptions = e => "object" == typeof e && e.hasOwnProperty("config");
|
|
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");
|
|
1327
1312
|
|
|
1328
1313
|
let _tsCompilerOptions = null, _tsCompilerOptionsKey = null;
|
|
1329
1314
|
|
|
1330
1315
|
const jestPreprocessor = {
|
|
1331
1316
|
process(e, t, r, s) {
|
|
1332
|
-
if (isJest27TransformOptions(r) && (s = r.config),
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
if ("
|
|
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) {
|
|
1337
1324
|
if (t.includes("import ") || t.includes("import.") || t.includes("import(")) return !0;
|
|
1338
1325
|
if (t.includes("export ")) return !0;
|
|
1339
1326
|
}
|
|
1340
|
-
return "css" ===
|
|
1327
|
+
return "css" === s;
|
|
1341
1328
|
}(t, e)) {
|
|
1342
1329
|
const r = {
|
|
1343
1330
|
file: t,
|
|
@@ -1354,7 +1341,8 @@ const jestPreprocessor = {
|
|
|
1354
1341
|
return e;
|
|
1355
1342
|
},
|
|
1356
1343
|
getCacheKey(e, t, r, s) {
|
|
1357
|
-
if (isJest27TransformOptions(r) && (s = r.config), !
|
|
1344
|
+
if (isJest27TransformOptions(r) && (s = r.config), !s) throw "Unable to find Jest transformation options.";
|
|
1345
|
+
if (!_tsCompilerOptionsKey) {
|
|
1358
1346
|
const e = getCompilerOptions(s.rootDir);
|
|
1359
1347
|
_tsCompilerOptionsKey = JSON.stringify(e);
|
|
1360
1348
|
}
|
|
@@ -2895,7 +2883,7 @@ const createSystem = e => {
|
|
|
2895
2883
|
u("/");
|
|
2896
2884
|
const S = {
|
|
2897
2885
|
name: "in-memory",
|
|
2898
|
-
version: "2.
|
|
2886
|
+
version: "2.18.0",
|
|
2899
2887
|
events: i,
|
|
2900
2888
|
access: async e => c(e),
|
|
2901
2889
|
accessSync: c,
|
|
@@ -3848,7 +3836,9 @@ exports.createJestPuppeteerEnvironment = function createJestPuppeteerEnvironment
|
|
|
3848
3836
|
flags: createConfigFlags(),
|
|
3849
3837
|
logger: mockLogger(),
|
|
3850
3838
|
outputTargets: null !== (t = r.outputTargets) && void 0 !== t ? t : [],
|
|
3839
|
+
rootDir: path__default.default.resolve("/"),
|
|
3851
3840
|
sys: createTestingSystem(),
|
|
3841
|
+
testing: {},
|
|
3852
3842
|
...e
|
|
3853
3843
|
};
|
|
3854
3844
|
}, exports.mockWindow = function mockWindow(e = null) {
|
|
@@ -12,5 +12,5 @@ export declare function buildJestArgv(config: d.ValidatedConfig): Config.Argv;
|
|
|
12
12
|
* @param config the Stencil config to use while generating Jest CLI arguments
|
|
13
13
|
* @returns the Jest Config to attach to the `argv` argument
|
|
14
14
|
*/
|
|
15
|
-
export declare function buildJestConfig(config: d.
|
|
15
|
+
export declare function buildJestConfig(config: d.ValidatedConfig): string;
|
|
16
16
|
export declare function getProjectListFromCLIArgs(config: d.Config, argv: Config.Argv): Config.Path[];
|
package/testing/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
2
|
import type * as d from '@stencil/core/internal';
|
|
3
|
+
import { InMemoryFileSystem } from '../compiler/sys/in-memory-fs';
|
|
3
4
|
export declare function shuffleArray(array: any[]): any[];
|
|
4
5
|
/**
|
|
5
6
|
* Testing utility to validate the existence of some provided file paths using a specific file system
|
|
@@ -8,7 +9,7 @@ export declare function shuffleArray(array: any[]): any[];
|
|
|
8
9
|
* @param filePaths the paths to validate
|
|
9
10
|
* @throws when one or more of the provided file paths cannot be found
|
|
10
11
|
*/
|
|
11
|
-
export declare function expectFilesExist(fs:
|
|
12
|
+
export declare function expectFilesExist(fs: InMemoryFileSystem, filePaths: string[]): void;
|
|
12
13
|
/**
|
|
13
14
|
* Testing utility to validate the non-existence of some provided file paths using a specific file system
|
|
14
15
|
*
|
|
@@ -16,9 +17,9 @@ export declare function expectFilesExist(fs: d.InMemoryFileSystem, filePaths: st
|
|
|
16
17
|
* @param filePaths the paths to validate
|
|
17
18
|
* @throws when one or more of the provided file paths is found
|
|
18
19
|
*/
|
|
19
|
-
export declare function expectFilesDoNotExist(fs:
|
|
20
|
-
export declare function getAppScriptUrl(config: d.
|
|
21
|
-
export declare function getAppStyleUrl(config: d.
|
|
20
|
+
export declare function expectFilesDoNotExist(fs: InMemoryFileSystem, filePaths: string[]): void;
|
|
21
|
+
export declare function getAppScriptUrl(config: d.ValidatedConfig, browserUrl: string): string;
|
|
22
|
+
export declare function getAppStyleUrl(config: d.ValidatedConfig, browserUrl: string): string;
|
|
22
23
|
/**
|
|
23
24
|
* Utility for silencing `console` functions in tests.
|
|
24
25
|
*
|