weifuwu 0.19.5 → 0.19.6
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/dist/index.js +6 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5215,14 +5215,13 @@ function buildHeadPayload(opts) {
|
|
|
5215
5215
|
const { ctx, base, compiledTailwindCss, isDev: isDev2 } = opts;
|
|
5216
5216
|
let result = "";
|
|
5217
5217
|
if (isDev2) {
|
|
5218
|
-
const vUrl = `${base}/__wfw/v/bundle`;
|
|
5219
5218
|
result += `<script type="importmap">{
|
|
5220
5219
|
"imports": {
|
|
5221
|
-
"react": "
|
|
5222
|
-
"react-dom": "
|
|
5223
|
-
"react-dom/client": "
|
|
5224
|
-
"react/jsx-runtime": "
|
|
5225
|
-
"weifuwu/react": "
|
|
5220
|
+
"react": "/__wfw/v/bundle",
|
|
5221
|
+
"react-dom": "/__wfw/v/bundle",
|
|
5222
|
+
"react-dom/client": "/__wfw/v/bundle",
|
|
5223
|
+
"react/jsx-runtime": "/__wfw/v/bundle",
|
|
5224
|
+
"weifuwu/react": "/__wfw/v/bundle"
|
|
5226
5225
|
}
|
|
5227
5226
|
}</script>
|
|
5228
5227
|
`;
|
|
@@ -5314,11 +5313,9 @@ function streamResponse(reactStream, opts) {
|
|
|
5314
5313
|
const body = buildBodyScripts(opts);
|
|
5315
5314
|
if (body) controller.enqueue(encoder2.encode("\n" + body));
|
|
5316
5315
|
if (opts.isDev) {
|
|
5317
|
-
const wsUrl = `${opts.base}/__weifuwu/livereload`;
|
|
5318
|
-
const hbUrl = `${opts.base}/__wfw/h/`;
|
|
5319
5316
|
controller.enqueue(encoder2.encode(
|
|
5320
5317
|
`
|
|
5321
|
-
<script>(function(){var ws=new WebSocket((location.protocol==='https:'?'wss:':'ws:')+'//'+location.host+'
|
|
5318
|
+
<script>(function(){var ws=new WebSocket((location.protocol==='https:'?'wss:':'ws:')+'//'+location.host+'/__weifuwu/livereload');var t=0;ws.onmessage=function(e){try{var m=JSON.parse(e.data);if(m.type==='component'){if(m.entry&&m.entry!==window.__WFW_ENTRY)return;import('/__wfw/h/'+m.hash+'?'+Date.now()).catch(function(){location.reload()});if(m.css){var s=document.querySelector('style[data-lr]')||function(){var x=document.createElement('style');x.setAttribute('data-lr','');document.head.appendChild(x);return x}();s.textContent=m.css}return}if(m.type==='css'){var s=document.querySelector('style[data-lr]')||function(){var x=document.createElement('style');x.setAttribute('data-lr','');document.head.appendChild(x);return x}();s.textContent=m.css;return}}catch(_){}if(e.data==='reload'&&Date.now()-t>1e3){t=Date.now();location.reload()}};ws.onclose=function(){if(Date.now()-t>1e3){t=Date.now();setTimeout(function(){location.reload()},500)}}})()</script>`
|
|
5322
5319
|
));
|
|
5323
5320
|
}
|
|
5324
5321
|
} catch {
|