@solidjs/start 2.0.0-alpha.0 → 2.0.0-alpha.2
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/CHANGELOG.md +28 -0
- package/dist/client/mount.d.ts +1 -7
- package/dist/client/mount.js +1 -99
- package/dist/config/constants.js +2 -2
- package/dist/config/dev-server.js +10 -0
- package/dist/config/fs-router.js +10 -22
- package/dist/config/fs-routes/fs-watcher.js +4 -4
- package/dist/config/fs-routes/index.js +4 -6
- package/dist/config/fs-routes/router.js +10 -11
- package/dist/config/fs-routes/tree-shake.js +12 -21
- package/dist/config/index.js +42 -42
- package/dist/config/lazy.js +42 -12
- package/dist/config/manifest.js +4 -3
- package/dist/config/vite-utils.d.ts +5 -0
- package/dist/config/vite-utils.js +7 -3
- package/dist/http/index.d.ts +1 -4
- package/dist/http/index.js +3 -5
- package/dist/index.d.ts +0 -1
- package/dist/middleware/index.d.ts +5 -2
- package/dist/middleware/index.js +6 -1
- package/dist/router.jsx +2 -2
- package/dist/server/StartServer.jsx +2 -0
- package/dist/server/assets/PatchVirtualDevStyles.d.ts +4 -0
- package/dist/server/assets/PatchVirtualDevStyles.jsx +28 -0
- package/dist/server/assets/index.js +1 -1
- package/dist/server/assets/render.jsx +2 -2
- package/dist/server/collect-styles.js +9 -21
- package/dist/server/fetchEvent.spec.js +1 -1
- package/dist/server/handler.js +30 -15
- package/dist/server/index.d.ts +1 -0
- package/dist/server/manifest/dev-client-manifest.js +1 -1
- package/dist/server/manifest/dev-ssr-manifest.js +1 -1
- package/dist/server/manifest/prod-ssr-manifest.js +7 -12
- package/dist/server/routes.js +3 -3
- package/dist/server/server-fns-runtime.js +2 -2
- package/dist/server/server-functions-handler.js +6 -11
- package/dist/server/server-runtime.js +8 -8
- package/dist/server/spa/StartServer.jsx +2 -0
- package/dist/shared/dev-overlay/CodeView.d.ts +1 -1
- package/dist/shared/dev-overlay/CodeView.jsx +23 -34
- package/dist/shared/dev-overlay/DevOverlayDialog.jsx +4 -4
- package/dist/shared/dev-overlay/get-source-map.d.ts +1 -1
- package/dist/shared/dev-overlay/get-source-map.js +5 -5
- package/dist/shared/dev-overlay/icons.d.ts +10 -10
- package/dist/shared/dev-overlay/icons.jsx +91 -91
- package/dist/shared/dev-overlay/index.jsx +1 -1
- package/dist/shared/lazy.js +4 -2
- package/env.d.ts +9 -0
- package/package.json +5 -4
- package/scripts/build.js +3 -3
- package/scripts/validate-imports.js +8 -8
- package/src/client/mount.ts +1 -114
- package/src/config/constants.ts +3 -3
- package/src/config/dev-server.ts +107 -99
- package/src/config/fs-router.ts +140 -155
- package/src/config/fs-routes/fs-watcher.ts +57 -61
- package/src/config/fs-routes/index.ts +117 -119
- package/src/config/fs-routes/router.ts +12 -13
- package/src/config/fs-routes/tree-shake.ts +342 -363
- package/src/config/index.ts +42 -43
- package/src/config/lazy.ts +47 -16
- package/src/config/manifest.ts +8 -7
- package/src/config/vite-utils.ts +9 -9
- package/src/env.d.ts +10 -28
- package/src/http/index.ts +105 -142
- package/src/index.tsx +0 -12
- package/src/internal.d.ts +1 -1
- package/src/middleware/index.ts +42 -49
- package/src/router.tsx +4 -3
- package/src/server/StartServer.tsx +3 -7
- package/src/server/assets/PatchVirtualDevStyles.tsx +31 -0
- package/src/server/assets/index.ts +1 -1
- package/src/server/assets/render.tsx +6 -2
- package/src/server/collect-styles.ts +49 -73
- package/src/server/fetchEvent.spec.ts +71 -75
- package/src/server/fetchEvent.ts +17 -17
- package/src/server/handler.ts +138 -129
- package/src/server/index.tsx +13 -0
- package/src/server/manifest/client-manifest.ts +1 -1
- package/src/server/manifest/dev-client-manifest.ts +7 -5
- package/src/server/manifest/dev-ssr-manifest.ts +8 -6
- package/src/server/manifest/prod-client-manifest.ts +7 -4
- package/src/server/manifest/prod-ssr-manifest.ts +78 -94
- package/src/server/manifest/ssr-manifest.ts +4 -2
- package/src/server/routes.ts +96 -108
- package/src/server/server-fns-runtime.ts +3 -3
- package/src/server/server-functions-handler.ts +294 -319
- package/src/server/server-runtime.ts +13 -13
- package/src/server/spa/StartServer.tsx +2 -0
- package/src/server/spa/handler.ts +12 -12
- package/src/server/types.ts +46 -46
- package/src/server/util.ts +4 -4
- package/src/shared/ErrorBoundary.tsx +1 -1
- package/src/shared/HttpHeader.tsx +20 -20
- package/src/shared/HttpStatusCode.ts +14 -14
- package/src/shared/clientOnly.ts +3 -3
- package/src/shared/dev-overlay/CodeView.tsx +43 -46
- package/src/shared/dev-overlay/DevOverlayDialog.tsx +4 -4
- package/src/shared/dev-overlay/createStackFrame.ts +59 -62
- package/src/shared/dev-overlay/env.d.ts +2 -2
- package/src/shared/dev-overlay/get-source-map.ts +5 -7
- package/src/shared/dev-overlay/icons.tsx +289 -121
- package/src/shared/dev-overlay/index.tsx +1 -1
- package/src/shared/lazy.ts +4 -3
- package/src/shared/serverFunction.ts +1 -1
- package/src/virtual.d.ts +10 -10
- package/tsconfig.json +2 -2
- package/vitest.config.ts +2 -2
|
@@ -52,99 +52,99 @@ export function SolidStartIcon(props) {
|
|
|
52
52
|
return (<svg viewBox="0 0 701 701" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
53
53
|
<title>{props.title}</title>
|
|
54
54
|
<g filter="url(#filter0_d_1_2)">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
55
|
+
<rect width="693" height="693" transform="translate(4)" fill="white"/>
|
|
56
|
+
<mask id="mask0_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="323" y="556" width="174" height="72">
|
|
57
|
+
<path d="M323.508 627.978L435.81 619.384C435.81 619.384 474.315 613.168 496.842 576.082L417.413 556.809L323.508 627.978Z" fill="white"/>
|
|
58
|
+
</mask>
|
|
59
|
+
<g mask="url(#mask0_1_2)">
|
|
60
|
+
<path d="M510.734 559.645L490 661.769L309.658 625.183L330.349 523.018L510.734 559.645Z" fill="url(#paint0_linear_1_2)"/>
|
|
61
|
+
</g>
|
|
62
|
+
<mask id="mask1_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="73" y="364" width="424" height="220">
|
|
63
|
+
<path d="M168.488 364.785C135.031 366.371 73.2477 372.295 73.2477 372.295L342.489 567.989L403.813 583.341L496.884 576.124L225.974 380.096C225.974 380.096 204.072 364.66 172.91 364.66C171.491 364.66 169.989 364.702 168.488 364.785Z" fill="white"/>
|
|
64
|
+
</mask>
|
|
65
|
+
<g mask="url(#mask1_1_2)">
|
|
66
|
+
<path d="M192.016 773.57L-24.954 425.942L378.115 174.389L595.085 522.017L192.016 773.57Z" fill="url(#paint1_linear_1_2)"/>
|
|
67
|
+
</g>
|
|
68
|
+
<mask id="mask2_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="515" y="255" width="179" height="71">
|
|
69
|
+
<path d="M515.573 325.822L631.254 318.688C631.254 318.688 670.885 312.931 693.621 275.928L611.438 255.487L515.573 325.822Z" fill="white"/>
|
|
70
|
+
</mask>
|
|
71
|
+
<g mask="url(#mask2_1_2)">
|
|
72
|
+
<path d="M557.832 401.58L485.62 272.174L651.32 179.729L723.532 309.135L557.832 401.58Z" fill="url(#paint2_linear_1_2)"/>
|
|
73
|
+
</g>
|
|
74
|
+
<mask id="mask3_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="254" y="59" width="440" height="223">
|
|
75
|
+
<path d="M352.251 59.0417C317.751 60.1681 254.132 65.2993 254.132 65.2993L534.345 265.666L597.755 281.936L693.621 275.928L411.697 75.2279C411.697 75.2279 388.294 59 355.505 59C354.42 59 353.335 59 352.251 59.0417Z" fill="white"/>
|
|
76
|
+
</mask>
|
|
77
|
+
<g mask="url(#mask3_1_2)">
|
|
78
|
+
<path d="M623.161 -102.236L775.386 246.226L324.592 443.172L172.325 94.7097L623.161 -102.236Z" fill="url(#paint3_linear_1_2)"/>
|
|
79
|
+
</g>
|
|
80
|
+
<mask id="mask4_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="6" y="371" width="396" height="257">
|
|
81
|
+
<path d="M6.62575 415.555C6.41717 415.889 6.20858 416.264 6 416.64L79.6305 469.912L153.261 523.185L275.909 611.917C317.125 641.744 373.318 628.895 401.393 583.215L326.762 529.234L252.13 475.252L130.483 387.229C115.632 376.508 98.8203 371.377 82.1335 371.377C53.0567 371.335 24.272 386.895 6.62575 415.555Z" fill="white"/>
|
|
82
|
+
</mask>
|
|
83
|
+
<g mask="url(#mask4_1_2)">
|
|
84
|
+
<path d="M529.756 464.03L265.855 829.387L-122.321 549.008L141.538 183.65L529.756 464.03Z" fill="url(#paint4_linear_1_2)"/>
|
|
85
|
+
</g>
|
|
86
|
+
<mask id="mask5_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="187" y="64" width="411" height="263">
|
|
87
|
+
<path d="M188.47 108.101C188.261 108.476 188.053 108.81 187.844 109.186L264.478 163.751L341.112 218.317L468.725 309.177C511.61 339.714 569.388 327.532 597.755 281.977L520.078 226.661L442.401 171.386L315.832 81.2352C300.063 70.0133 282.25 64.6318 264.645 64.6318C235.026 64.6318 206.074 79.9002 188.47 108.101Z" fill="white"/>
|
|
88
|
+
</mask>
|
|
89
|
+
<g mask="url(#mask5_1_2)">
|
|
90
|
+
<path d="M685.945 96.6704L550.031 471.164L99.6544 307.675L235.527 -66.8184L685.945 96.6704Z" fill="url(#paint5_linear_1_2)"/>
|
|
91
|
+
</g>
|
|
92
|
+
<mask id="mask6_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="134" y="164" width="419" height="344">
|
|
93
|
+
<path d="M134.363 170.051L233.149 278.64C237.571 284.856 242.744 290.571 248.626 295.66L441.567 507.791L537.432 501.784C565.8 456.229 554.036 394.53 511.151 363.993L383.539 273.133L306.863 218.567L230.229 164.002L134.363 170.051Z" fill="white"/>
|
|
94
|
+
</mask>
|
|
95
|
+
<g mask="url(#mask6_1_2)">
|
|
96
|
+
<path d="M291.886 715.5L-31.1699 289.528L408.235 -43.7072L731.291 382.265L291.886 715.5Z" fill="url(#paint6_linear_1_2)"/>
|
|
97
|
+
</g>
|
|
98
|
+
<mask id="mask7_1_2" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="118" y="170" width="340" height="338">
|
|
99
|
+
<path d="M133.696 171.094C105.703 216.065 117.301 276.971 159.644 307.091L286.255 397.241L363.932 452.516L441.609 507.791C469.976 462.236 458.212 400.537 415.327 370L287.631 279.141L210.997 224.575L134.363 170.051C134.154 170.384 133.904 170.718 133.696 171.094Z" fill="white"/>
|
|
100
|
+
</mask>
|
|
101
|
+
<g mask="url(#mask7_1_2)">
|
|
102
|
+
<path d="M606.057 239.009L395.553 654.635L-30.4607 438.833L180.043 23.2069L606.057 239.009Z" fill="url(#paint7_linear_1_2)"/>
|
|
103
|
+
</g>
|
|
104
104
|
</g>
|
|
105
105
|
<defs>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
106
|
+
<filter id="filter0_d_1_2" x="0" y="0" width="701" height="701" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
107
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
108
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
109
|
+
<feOffset dy="4"/>
|
|
110
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
111
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
112
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
113
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_2"/>
|
|
114
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_2" result="shape"/>
|
|
115
|
+
</filter>
|
|
116
|
+
<linearGradient id="paint0_linear_1_2" x1="522.269" y1="40.5341" x2="374.272" y2="769.949" gradientUnits="userSpaceOnUse">
|
|
117
|
+
<stop stop-color="#1593F5"/>
|
|
118
|
+
<stop offset="1" stop-color="#0084CE"/>
|
|
119
|
+
</linearGradient>
|
|
120
|
+
<linearGradient id="paint1_linear_1_2" x1="507.729" y1="830.625" x2="-112.45" y2="-163.072" gradientUnits="userSpaceOnUse">
|
|
121
|
+
<stop stop-color="#1593F5"/>
|
|
122
|
+
<stop offset="1" stop-color="#0084CE"/>
|
|
123
|
+
</linearGradient>
|
|
124
|
+
<linearGradient id="paint2_linear_1_2" x1="915.255" y1="847.35" x2="541.738" y2="177.838" gradientUnits="userSpaceOnUse">
|
|
125
|
+
<stop stop-color="white"/>
|
|
126
|
+
<stop offset="1" stop-color="#15ABFF"/>
|
|
127
|
+
</linearGradient>
|
|
128
|
+
<linearGradient id="paint3_linear_1_2" x1="254.189" y1="-332.587" x2="571.326" y2="393.304" gradientUnits="userSpaceOnUse">
|
|
129
|
+
<stop stop-color="white"/>
|
|
130
|
+
<stop offset="1" stop-color="#79CFFF"/>
|
|
131
|
+
</linearGradient>
|
|
132
|
+
<linearGradient id="paint4_linear_1_2" x1="610.213" y1="-56.2573" x2="106.317" y2="641.444" gradientUnits="userSpaceOnUse">
|
|
133
|
+
<stop stop-color="#0057E5"/>
|
|
134
|
+
<stop offset="1" stop-color="#0084CE"/>
|
|
135
|
+
</linearGradient>
|
|
136
|
+
<linearGradient id="paint5_linear_1_2" x1="496.212" y1="-82.6564" x2="337.643" y2="354.288" gradientUnits="userSpaceOnUse">
|
|
137
|
+
<stop stop-color="white"/>
|
|
138
|
+
<stop offset="1" stop-color="#15ABFF"/>
|
|
139
|
+
</linearGradient>
|
|
140
|
+
<linearGradient id="paint6_linear_1_2" x1="693.692" y1="789.133" x2="-102.675" y2="-260.944" gradientUnits="userSpaceOnUse">
|
|
141
|
+
<stop stop-color="white"/>
|
|
142
|
+
<stop offset="1" stop-color="#79CFFF"/>
|
|
143
|
+
</linearGradient>
|
|
144
|
+
<linearGradient id="paint7_linear_1_2" x1="555.118" y1="-188.777" x2="146.363" y2="618.161" gradientUnits="userSpaceOnUse">
|
|
145
|
+
<stop stop-color="white"/>
|
|
146
|
+
<stop offset="1" stop-color="#79CFFF"/>
|
|
147
|
+
</linearGradient>
|
|
148
148
|
</defs>
|
|
149
149
|
</svg>);
|
|
150
150
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @refresh skip
|
|
2
|
-
import { ErrorBoundary, Show, createEffect, createSignal, onCleanup, resetErrorBoundaries } from "solid-js";
|
|
2
|
+
import { ErrorBoundary, Show, createEffect, createSignal, onCleanup, resetErrorBoundaries, } from "solid-js";
|
|
3
3
|
import { HttpStatusCode } from "../HttpStatusCode.js";
|
|
4
4
|
import clientOnly from "../clientOnly.js";
|
|
5
5
|
const DevOverlayDialog = import.meta.env.PROD
|
package/dist/shared/lazy.js
CHANGED
|
@@ -31,10 +31,12 @@ const withAssets = function (fn) {
|
|
|
31
31
|
const { nonce } = getRequestEvent();
|
|
32
32
|
useAssets(assets, nonce);
|
|
33
33
|
return mod.default(props);
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
return wrapper;
|
|
38
38
|
};
|
|
39
|
-
const lazy = !isServer
|
|
39
|
+
const lazy = !isServer
|
|
40
|
+
? solidLazy
|
|
41
|
+
: (fn) => solidLazy(withAssets(fn));
|
|
40
42
|
export default lazy;
|
package/env.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/start",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.jsx",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"./server/spa": "./dist/server/spa/index.jsx",
|
|
12
12
|
"./client/spa": "./dist/client/spa/index.jsx",
|
|
13
13
|
"./middleware": "./dist/middleware/index.js",
|
|
14
|
-
"./http": "./dist/http/index.js"
|
|
14
|
+
"./http": "./dist/http/index.js",
|
|
15
|
+
"./env": "./env.d.ts"
|
|
15
16
|
},
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
@@ -36,8 +37,8 @@
|
|
|
36
37
|
"path-to-regexp": "^8.2.0",
|
|
37
38
|
"pathe": "^2.0.3",
|
|
38
39
|
"radix3": "^1.1.2",
|
|
39
|
-
"seroval": "^1.
|
|
40
|
-
"seroval-plugins": "^1.
|
|
40
|
+
"seroval": "^1.4.1",
|
|
41
|
+
"seroval-plugins": "^1.4.0",
|
|
41
42
|
"shiki": "^1.26.1",
|
|
42
43
|
"solid-js": "^1.9.9",
|
|
43
44
|
"source-map-js": "^1.2.1",
|
package/scripts/build.js
CHANGED
|
@@ -115,7 +115,7 @@ function extractImportExportStatements(content, filePath) {
|
|
|
115
115
|
// Export from: export { ... } from '...'
|
|
116
116
|
/export\s+(?:\{[^}]*\}|\*)\s+from\s+['"`]([^'"`]+)['"`]/g,
|
|
117
117
|
// Export default from: export { default } from '...'
|
|
118
|
-
/export\s+\{\s*default\s*\}\s+from\s+['"`]([^'"`]+)['"`]/g
|
|
118
|
+
/export\s+\{\s*default\s*\}\s+from\s+['"`]([^'"`]+)['"`]/g,
|
|
119
119
|
// Note: Dynamic imports are excluded as they're handled by bundlers
|
|
120
120
|
];
|
|
121
121
|
|
|
@@ -147,7 +147,7 @@ function extractImportExportStatements(content, filePath) {
|
|
|
147
147
|
path: importPath,
|
|
148
148
|
line: lineNumber + 1,
|
|
149
149
|
fullLine: line.trim(),
|
|
150
|
-
filePath
|
|
150
|
+
filePath,
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -175,7 +175,7 @@ function validateFile(filePath) {
|
|
|
175
175
|
line: statement.line,
|
|
176
176
|
importPath: statement.path,
|
|
177
177
|
fullLine: statement.fullLine,
|
|
178
|
-
type: "invalid-extension"
|
|
178
|
+
type: "invalid-extension",
|
|
179
179
|
});
|
|
180
180
|
} else if (!hasValidExtension(statement.path)) {
|
|
181
181
|
errors.push({
|
|
@@ -183,7 +183,7 @@ function validateFile(filePath) {
|
|
|
183
183
|
line: statement.line,
|
|
184
184
|
importPath: statement.path,
|
|
185
185
|
fullLine: statement.fullLine,
|
|
186
|
-
type: "missing-extension"
|
|
186
|
+
type: "missing-extension",
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -243,7 +243,7 @@ function validateImports() {
|
|
|
243
243
|
|
|
244
244
|
if (missingExtensionErrors.length > 0) {
|
|
245
245
|
console.log(
|
|
246
|
-
`❌ Found ${missingExtensionErrors.length} relative import(s) without extensions:\n
|
|
246
|
+
`❌ Found ${missingExtensionErrors.length} relative import(s) without extensions:\n`,
|
|
247
247
|
);
|
|
248
248
|
|
|
249
249
|
const missingByFile = new Map();
|
|
@@ -262,7 +262,7 @@ function validateImports() {
|
|
|
262
262
|
console.log(` Line ${error.line}: ${error.importPath}`);
|
|
263
263
|
console.log(` ${error.fullLine}`);
|
|
264
264
|
console.log(
|
|
265
|
-
` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}
|
|
265
|
+
` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}`,
|
|
266
266
|
);
|
|
267
267
|
});
|
|
268
268
|
console.log("");
|
|
@@ -271,7 +271,7 @@ function validateImports() {
|
|
|
271
271
|
|
|
272
272
|
if (invalidExtensionErrors.length > 0) {
|
|
273
273
|
console.log(
|
|
274
|
-
`❌ Found ${invalidExtensionErrors.length} relative import(s) with invalid extensions:\n
|
|
274
|
+
`❌ Found ${invalidExtensionErrors.length} relative import(s) with invalid extensions:\n`,
|
|
275
275
|
);
|
|
276
276
|
|
|
277
277
|
const invalidByFile = new Map();
|
|
@@ -290,7 +290,7 @@ function validateImports() {
|
|
|
290
290
|
console.log(` Line ${error.line}: ${error.importPath}`);
|
|
291
291
|
console.log(` ${error.fullLine}`);
|
|
292
292
|
console.log(
|
|
293
|
-
` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}
|
|
293
|
+
` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}`,
|
|
294
294
|
);
|
|
295
295
|
});
|
|
296
296
|
console.log("");
|
package/src/client/mount.ts
CHANGED
|
@@ -1,114 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { createStore } from "solid-js/store";
|
|
3
|
-
import {
|
|
4
|
-
createComponent,
|
|
5
|
-
getHydrationKey,
|
|
6
|
-
getOwner,
|
|
7
|
-
hydrate,
|
|
8
|
-
type MountableElement
|
|
9
|
-
} from "solid-js/web";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/client/mount
|
|
14
|
-
*/
|
|
15
|
-
export function mount(fn: () => JSX.Element, el: MountableElement) {
|
|
16
|
-
if (import.meta.env.START_ISLANDS) {
|
|
17
|
-
const map = new WeakMap();
|
|
18
|
-
async function mountIsland(el: HTMLElement) {
|
|
19
|
-
if (el.dataset.css) {
|
|
20
|
-
let css = JSON.parse(el.dataset.css);
|
|
21
|
-
for (let href of css) {
|
|
22
|
-
if (!document.querySelector(`link[href="${href}"]`)) {
|
|
23
|
-
let link = document.createElement("link");
|
|
24
|
-
link.rel = "stylesheet";
|
|
25
|
-
link.href = href;
|
|
26
|
-
document.head.appendChild(link);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let mod = await import(
|
|
32
|
-
/* @vite-ignore */
|
|
33
|
-
import.meta.env.MANIFEST["client"]!.chunks[el.dataset.id!.split("#")[0] as string]!.output
|
|
34
|
-
.path
|
|
35
|
-
);
|
|
36
|
-
if (!mod || !el.dataset.hk) return;
|
|
37
|
-
|
|
38
|
-
let Component = mod[el.dataset.id!.split("#")[1] as string];
|
|
39
|
-
let hk = el.dataset.hk;
|
|
40
|
-
// _$DEBUG("hydrating island", el.dataset.island, hk.slice(0, hk.length - 1) + `1-`, el);
|
|
41
|
-
|
|
42
|
-
let props = createStore({
|
|
43
|
-
...JSON.parse(el.dataset.props!),
|
|
44
|
-
get children() {
|
|
45
|
-
const p = el.getElementsByTagName("solid-children");
|
|
46
|
-
getHydrationKey();
|
|
47
|
-
[...p].forEach(a => {
|
|
48
|
-
(a as any).__$owner = getOwner();
|
|
49
|
-
});
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
map.set(el, props);
|
|
55
|
-
|
|
56
|
-
hydrate(() => createComponent(Component, props[0]), el, {
|
|
57
|
-
renderId: hk.slice(0, hk.length - 1) + `${1 + Number(el.dataset.offset)}-`,
|
|
58
|
-
owner: lookupOwner(el)
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
delete el.dataset.hk;
|
|
62
|
-
el.dataset.hkk = hk;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let queue: HTMLElement[] = [];
|
|
66
|
-
let queued = false;
|
|
67
|
-
function runTaskQueue(info: any) {
|
|
68
|
-
while (info.timeRemaining() > 0 && queue.length) {
|
|
69
|
-
mountIsland(queue.shift()!);
|
|
70
|
-
}
|
|
71
|
-
if (queue.length) {
|
|
72
|
-
requestIdleCallback(runTaskQueue);
|
|
73
|
-
} else queued = false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const hydrateIslands = () => {
|
|
77
|
-
const islands: NodeListOf<HTMLElement> = document.querySelectorAll("solid-island[data-hk]");
|
|
78
|
-
const assets = new Set<string>();
|
|
79
|
-
islands.forEach((el: HTMLElement) => el.dataset.id && assets.add(el.dataset.id));
|
|
80
|
-
Promise.all(
|
|
81
|
-
[...assets].map(
|
|
82
|
-
asset =>
|
|
83
|
-
import(
|
|
84
|
-
/* @vite-ignore */ import.meta.env.MANIFEST["client"]!.chunks[
|
|
85
|
-
asset.split("#")[0] as string
|
|
86
|
-
]!.output.path
|
|
87
|
-
)
|
|
88
|
-
)
|
|
89
|
-
)
|
|
90
|
-
.then(() => {
|
|
91
|
-
islands.forEach((el: HTMLElement) => {
|
|
92
|
-
if (el.dataset.when === "idle" && "requestIdleCallback" in window) {
|
|
93
|
-
if (!queued) {
|
|
94
|
-
queued = true;
|
|
95
|
-
requestIdleCallback(runTaskQueue);
|
|
96
|
-
}
|
|
97
|
-
queue.push(el);
|
|
98
|
-
} else mountIsland(el as HTMLElement);
|
|
99
|
-
});
|
|
100
|
-
})
|
|
101
|
-
.catch(e => console.error(e));
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
function lookupOwner(el: HTMLElement) {
|
|
105
|
-
const parent = el.closest("solid-children");
|
|
106
|
-
return parent && (parent as any).__$owner;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
hydrateIslands();
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
return hydrate(fn, el);
|
|
114
|
-
}
|
|
1
|
+
export { hydrate as mount } from "solid-js/web"
|
package/src/config/constants.ts
CHANGED
|
@@ -10,10 +10,10 @@ export const VIRTUAL_MODULES = {
|
|
|
10
10
|
serverFnManifest: "solidstart:server-fn-manifest",
|
|
11
11
|
clientEntry: "solid-start:client-entry",
|
|
12
12
|
serverEntry: "solid-start:server-entry",
|
|
13
|
-
app: "solid-start:app"
|
|
13
|
+
app: "solid-start:app",
|
|
14
14
|
} as const;
|
|
15
15
|
|
|
16
16
|
export const VITE_ENVIRONMENTS = {
|
|
17
17
|
client: "client",
|
|
18
|
-
server: "ssr"
|
|
19
|
-
}
|
|
18
|
+
server: "ssr",
|
|
19
|
+
};
|