Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1518,3 +1518,5 @@ Verified against current majors, all green with no adapter code changes: `@bugse

### launch() with a missing app token no longer throws (#198, 2026-11-12)
`launch(undefined)` on Node/Bun died with an opaque `TypeError ... reading 'length'` inside `hashAppToken`, crashing the host at startup. Every runtime composition root (`@bugsee/node` + bun, `@bugsee/electron` `launchMain`/`launchRenderer` (guard before any wiring; a bad-token renderer sends no hello and takes no page slot), `@bugsee/browser` + umbrella/electron-renderer, `@bugsee/vercel-edge` + cloudflare, `@bugsee/webworker`) now calls the shared `createDisabledClientForMissingToken` (`@bugsee/core` `app-token.ts`) first: a missing / empty / whitespace-only / non-string token reports ONE `Bugsee: the app token is missing ...` error through `onError` (else `console.warn`) and returns a DISABLED client (never started, `launch()` is a no-op, claims no carrier slot, so a later valid launch works; the browser one resolves it, `showReportDialog()` resolves `null`). `@bugsee/webview` is untouched (the native host owns the token; the JS side never uses it on the wire). Tests: `app-token.test.ts` + `launch-missing-token.test.ts` per entry.

**Follow-up 2 (issue #11).** `sveltekit-e2e` now wires `sveltekit({ preprocess: [componentAnnotatePreprocessor()] })` (the `@bugsee/sveltekit` README Kit 3 call, with the plugin imported by path) and asserts the SSR HTML carries `data-bugsee-component` (mutation-checked: removing `preprocess` fails it). The plugin is imported from its built dist (the e2e builds it first) because Kit 3 re-loads `vite.config.ts` in a plain-Node post-build process that cannot resolve the workspace's extensionless TS source. The README nits were already fixed (#157). Only Rollup 5 (still prerelease, `5.0.0-2` on the `beta` tag) remains open: keep watching.
1 change: 1 addition & 0 deletions packages/sveltekit-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@bugsee/e2e-kit": "workspace:*",
"@bugsee/svelte-plugin-component-annotate": "workspace:*",
"@bugsee/sveltekit": "workspace:*",
"@bugsee/util": "workspace:*"
},
Expand Down
16 changes: 16 additions & 0 deletions packages/sveltekit-e2e/test/sveltekit.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ describe('@bugsee/sveltekit — real SvelteKit boot e2e', () => {
beforeAll(async () => {
collector = await startMockCollector();

const annotate = spawnSync(
'pnpm',
['--filter', '@bugsee/svelte-plugin-component-annotate', 'build'],
{
cwd: appDir,
encoding: 'utf8',
},
);
if (annotate.status !== 0)
throw new Error(`annotate build failed:\n${annotate.stdout}\n${annotate.stderr}`);

const build = spawnSync('pnpm', ['exec', 'vite', 'build'], { cwd: appDir, encoding: 'utf8' });
if (build.status !== 0) throw new Error(`vite build failed:\n${build.stdout}\n${build.stderr}`);

Expand Down Expand Up @@ -101,6 +112,11 @@ describe('@bugsee/sveltekit — real SvelteKit boot e2e', () => {
expect(html).toContain('<meta name="traceparent"');
});

it('the documented Kit 3 `sveltekit({ preprocess })` wiring runs the component-annotate preprocessor (README example)', async () => {
const html = await (await fetch(`${base}/`)).text();
expect(html).toMatch(/<h1[^>]*data-bugsee-component="routes"/); // routes/+page.svelte -> enclosing dir name
});

it('reports a thrown endpoint as an uploaded bundle (moat server-error path)', async () => {
const res = await fetch(`${base}/api/boom`);
expect(res.status).toBe(500); // the endpoint really threw
Expand Down
6 changes: 5 additions & 1 deletion packages/sveltekit-e2e/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import adapter from '@sveltejs/adapter-node';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { componentAnnotatePreprocessor } from '../svelte-plugin-component-annotate/dist/index.js';

// Kit 3 rejects `svelte.config.js`: configuration is passed through the `sveltekit(...)` plugin.
// `preprocess` mirrors the @bugsee/sveltekit README example (asserted in the e2e). The plugin is imported from
// its BUILT dist (the e2e builds it first): Kit re-loads this file in a plain-Node post-build process, which cannot
// resolve the workspace's extensionless TS source (published consumers get dist anyway).
// The @bugsee/* + bugsee packages are consumed as TS SOURCE in the workspace — Vite must bundle+transpile
// them for SSR (not externalize them as pre-built JS).
export default defineConfig({
plugins: [sveltekit({ adapter: adapter() })],
plugins: [sveltekit({ adapter: adapter(), preprocess: [componentAnnotatePreprocessor()] })],
ssr: { noExternal: [/@bugsee\//, 'bugsee'] },
});
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.