Skip to content

Commit d678a5c

Browse files
committed
wip
1 parent 3645426 commit d678a5c

File tree

49 files changed

+139
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+139
-149
lines changed

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docs/src/repl/repl.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const Repl = component$((props: ReplProps) => {
9090
input.version = v.version;
9191

9292
window.addEventListener('message', (ev) => receiveMessageFromReplServer(ev, store, input));
93+
console.log(await import('../routes/repl/repl-sw.js/entry.ts?raw'));
9394
store.serverUrl = new URL(`/repl/~repl-server-host.html?${store.clientId}`, origin).href;
9495

9596
// Now get the version from the network

packages/docs/src/repl/worker/app-ssr-html.ts

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export const appSsrHtml = async (options: ReplInputOptions, cache: Cache, result
7171
base: baseUrl,
7272
manifest: result.manifest,
7373
prefetchStrategy: null as any,
74+
}).catch((e) => {
75+
console.error('SSR failed', e);
76+
return {
77+
html: `<html><h1>SSR Error</h1><pre><code>${String(e).replaceAll('<', '&lt;')}</code></pre></html>`,
78+
};
7479
});
7580

7681
console.log = log;

packages/docs/src/repl/worker/repl-request-handler.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { QWIK_REPL_RESULT_CACHE } from './repl-constants';
44
// import { sendMessageToReplServer } from './repl-messenger';
55

6-
export const requestHandler = async (ev: any) => {
6+
export const requestHandler = async (ev: FetchEvent) => {
77
const reqUrl = new URL(ev.request.url);
88
const pathname = reqUrl.pathname;
99
const parts = pathname.split('/');
@@ -50,6 +50,19 @@ export const requestHandler = async (ev: any) => {
5050
return rsp;
5151
}
5252

53+
if (ev.request.url.includes('/repl/')) {
54+
return new Response(
55+
'500 - Cannot communicate with REPL service worker - ' + ev.request.url,
56+
{
57+
headers: {
58+
'Content-Type': 'text/plain; charset=utf-8',
59+
'Cache-Control': 'no-store, no-cache, max-age=0',
60+
'X-Qwik-REPL-App': 'Error',
61+
},
62+
status: 500,
63+
}
64+
);
65+
}
5366
return new Response('404 - ' + ev.request.url, {
5467
headers: {
5568
'Content-Type': 'text/plain; charset=utf-8',

packages/docs/src/repl/worker/repl-server.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* - Source for url: "/repl/~repl-server.js"
2+
* - Source for url: "/repl/~repl-server-host.js"
33
* - Created from the route: "src/routes/repl/~repl-server.js/entry.ts"
44
* - Script executed from url: "/repl/~repl-server-host.html"
55
* - Public static html source file: "public/repl/~repl-server-host.html"
@@ -105,14 +105,15 @@ export const initReplServer = (win: Window, doc: Document, nav: Navigator) => {
105105
} else {
106106
loadTmr = setTimeout(() => {
107107
console.error('Qwik REPL server "%s" has not initialized', clientId);
108-
}, 15000);
108+
}, 60000);
109109

110110
nav.serviceWorker
111111
.register('/repl/repl-sw.js', {
112112
scope: '/repl/',
113113
})
114114
.then(
115115
(reg) => {
116+
console.trace('Qwik REPL server "%s" service worker registered', clientId, reg);
116117
swRegistration = reg;
117118
if (swRegistration.active) {
118119
console.debug('Qwik REPL server "%s" service worker registration active', clientId);
@@ -146,7 +147,7 @@ export const initReplServer = (win: Window, doc: Document, nav: Navigator) => {
146147
console.error('Qwik REPL Server "%s" service worker registration failed:', clientId, err);
147148
}
148149
)
149-
.catch((e) => console.error(e));
150+
.catch((e) => console.error('REPL service worker error', e));
150151

151152
doc.title += ': ' + clientId;
152153
win.addEventListener('message', receiveMessageFromMainApp);

packages/docs/src/routes/repl/repl-sw.js/entry.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ import { requestHandler } from '../../../repl/worker/repl-request-handler';
1111
self.onmessage = receiveMessageFromMain;
1212

1313
self.onfetch = requestHandler;
14-
14+
self.onsync = (ev) => {
15+
debugger;
16+
};
1517
self.oninstall = (ev) => {
18+
debugger;
1619
self.skipWaiting();
1720
ev.waitUntil(
1821
Promise.all([caches.open(QWIK_REPL_DEPS_CACHE), caches.open(QWIK_REPL_RESULT_CACHE)])
1922
);
2023
};
2124

22-
self.onactivate = () => self.clients.claim();
25+
self.onactivate = () => {
26+
debugger;
27+
self.clients.claim();
28+
};
2329

2430
export interface ReplGlobalApi {
2531
qwikCore?: typeof import('@builder.io/qwik');
@@ -34,8 +40,8 @@ export interface ReplGlobalApi {
3440

3541
export interface QwikWorkerGlobal extends ReplGlobalApi {
3642
onmessage: (ev: MessageEvent) => void;
37-
onfetch: (ev: Event) => void;
38-
oninstall: (ev: any) => void;
43+
onfetch: (ev: FetchEvent) => void;
44+
oninstall: (ev: ExtendableEvent) => void;
3945
onactivate: () => void;
4046
skipWaiting: () => void;
4147
clients: {

packages/docs/vite.config.mts

+23-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,28 @@ export default defineConfig(async () => {
5858
},
5959

6060
plugins: [
61+
{
62+
name: 'spy',
63+
enforce: 'pre',
64+
resolveId: {
65+
order: 'pre',
66+
handler(id, importer) {
67+
console.log('===================== spy resolveId', id, importer);
68+
},
69+
},
70+
load: {
71+
order: 'pre',
72+
handler(id, options) {
73+
console.log('===================== spy load', id, options);
74+
},
75+
},
76+
transform: {
77+
order: 'pre',
78+
handler(code, id, options) {
79+
console.log('===================== spy transform', id, options);
80+
},
81+
},
82+
},
6183
qwikCity({
6284
mdxPlugins: {
6385
rehypeSyntaxHighlight: false,
@@ -112,7 +134,7 @@ export default defineConfig(async () => {
112134
],
113135
},
114136
}),
115-
qwikVite(),
137+
qwikVite({ debug: true }),
116138
partytownVite({
117139
dest: resolve('dist', '~partytown'),
118140
}),

packages/qwik-city/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"@azure/functions": "^3.5.1",
1919
"@builder.io/qwik": "workspace:^",
20-
"@microsoft/api-extractor": "^7.43.1",
20+
"@microsoft/api-extractor": "7.43.1",
2121
"@netlify/edge-functions": "^2.3.1",
2222
"@types/mdast": "^4.0.1",
2323
"@types/node": "^20.12.7",

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_build_server.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2618
3+
assertion_line: 2656
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_class_name.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2535
3+
assertion_line: 2573
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_derived_signals_children.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2728
3+
assertion_line: 2787
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_derived_signals_cmp.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2861
3+
assertion_line: 2920
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_derived_signals_complext_children.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2830
3+
assertion_line: 2888
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_derived_signals_div.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2640
3+
assertion_line: 2699
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_derived_signals_multiple_children.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2783
3+
assertion_line: 2842
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_dev_mode_inlined.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2187
3+
assertion_line: 2246
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_export_issue.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2296
3+
assertion_line: 2334
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_getter_generation.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2962
3+
assertion_line: 3000
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_immutable_function_components.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2469
3+
assertion_line: 2528
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_issue_33443.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2914
3+
assertion_line: 2973
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_issue_4438.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2704
3+
assertion_line: 2763
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_keyed.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2327
3+
assertion_line: 2365
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_keyed_dev.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2353
3+
assertion_line: 2391
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_mutable_children.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2361
3+
assertion_line: 2420
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_noop_dev_mode.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2206
3+
assertion_line: 2208
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_of_synchronous_qrl.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 3474
3+
assertion_line: 3512
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_preserve_filenames.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2546
3+
assertion_line: 2605
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_preserve_filenames_hooks.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2591
3+
assertion_line: 2629
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_react.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 3006
3+
assertion_line: 3044
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_react_inline.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 3088
3+
assertion_line: 3147
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_sdk_inline.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 3212
3+
assertion_line: 3250
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_spread_jsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2253
3+
assertion_line: 2291
44
expression: output
55
---
66
==INPUT==

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_strip_client_code.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 1814
3+
assertion_line: 1816
44
expression: output
55
---
66
==INPUT==

0 commit comments

Comments
 (0)