File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1111 "exports" : {
1212 "." : " ./core.js" ,
1313 "./*" : " ./*" ,
14+ "./ssr-shims.js" : {
15+ "node" : " ./ssr-shims.js" ,
16+ "import" : " ./core.js" ,
17+ "default" : " ./core.js"
18+ },
1419 "./controllers/*" : " ./controllers/*" ,
1520 "./decorators/*" : " ./decorators/*" ,
1621 "./functions/*" : " ./functions/*" ,
Original file line number Diff line number Diff line change 1+ class ObserverShim {
2+ observe ( ) : void {
3+ void 0 ;
4+ }
5+
6+ disconnect ( ) : void {
7+ void 0 ;
8+ }
9+ }
10+
11+ class MiniHTMLElement {
12+ innerHTML = '' ;
13+ constructor ( public tagName : string ) { }
14+ }
15+
16+ class MiniHTMLTemplateElement extends MiniHTMLElement {
17+ content = { cloneNode : ( ) : string => this . innerHTML } ;
18+ }
19+
20+ class MiniDocument {
21+ createElement ( tagName : string ) : MiniHTMLElement {
22+ switch ( tagName ) {
23+ case 'template' :
24+ return new MiniHTMLTemplateElement ( tagName ) ;
25+ default :
26+ return new MiniHTMLElement ( tagName ) ;
27+ }
28+ }
29+ }
30+
31+ // @ts -expect-error: this runs in node
32+ globalThis . window ??= globalThis ;
33+ // @ts -expect-error: this runs in node
34+ globalThis . document ??= new MiniDocument ( ) ;
35+ // @ts -expect-error: this runs in node
36+ globalThis . navigator ??= { userAgent : '' } ;
37+ // @ts -expect-error: this runs in node
38+ globalThis . ErrorEvent ??= Event ;
39+ // @ts -expect-error: this runs in node
40+ globalThis . IntersectionObserver ??= ObserverShim ;
41+ // @ts -expect-error: this runs in node
42+ globalThis . MutationObserver ??= ObserverShim ;
43+ // @ts -expect-error: this runs in node
44+ globalThis . getComputedStyle ??= function ( ) {
45+ return {
46+ getPropertyPriority ( ) {
47+ return '' ;
48+ } ,
49+ getPropertyValue ( ) {
50+ return '' ;
51+ } ,
52+ } ;
53+ }
54+
55+ ;
56+
You can’t perform that action at this time.
0 commit comments