You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ Guidelines:
77
77
78
78
## SvelteKit configuration
79
79
80
-
The app uses Svelte's experimental async features and SvelteKit's remote functions. All SvelteKit configuration is passed to the `sveltekit()` plugin in `vite.config.ts` (the newer configuration style, expected to become the default in SvelteKit 3); `svelte.config.js` stays an empty stub so tools that require its presence keep working. The "svelte.config.js is ignored" warning printed by dev/build/check commands is expected with this setup.
80
+
The app targets the SvelteKit 3 prerelease line, beginning with `@sveltejs/kit@3.0.0-next.12`. All SvelteKit configuration is passed to the `sveltekit()` plugin in `vite.config.ts`; SvelteKit 3 no longer supports `svelte.config.js`. Internal library imports use the package-level `#lib` subpath alias declared in `package.json`, replacing SvelteKit 2's generated `$lib` alias. The app uses Svelte's experimental async features, SvelteKit remote functions, and explicit environment variables.
81
81
82
82
```ts
83
83
sveltekit({
@@ -95,14 +95,16 @@ sveltekit({
95
95
96
96
**Experimental async** allows `await` in Svelte markup and top-level `await` in `<script>` tags, enabling components to load data inline without separate `+page.server.js` load functions.
97
97
98
+
SvelteKit 3 removes adapter-node's runtime `ORIGIN` handling. Editable continues to use its declared `ORIGIN` variable for canonical metadata, while deployed Node servers derive request origins from trusted reverse-proxy headers by setting `PROTOCOL_HEADER=x-forwarded-proto` and `HOST_HEADER=x-forwarded-host`. Production Node deployments assume HTTPS. A direct plain-HTTP adapter-node smoke test must provide an `x-forwarded-proto: http` header when that protocol header is configured.
99
+
98
100
**Remote functions** (`$app/server`) allow server-side functions to be called directly from components via `query()` and `action()`. This replaces traditional REST endpoints for document loading and saving:
99
101
100
102
-**`src/lib/api.remote.ts`** — server-side functions for document and asset operations, called directly from components. Uses `query()` for reads and `action()` for writes. Access to `locals` (e.g. for auth checks) via `getRequestEvent()`.
101
103
102
104
**Server initialization** — `src/hooks.server.ts` exports an `init()` function (SvelteKit's `ServerInit` hook) that runs once on server startup. This is where database migration runs:
103
105
104
106
```js
105
-
importmigratefrom'$lib/server/migrate.js';
107
+
importmigratefrom'#lib/server/migrate.js';
106
108
107
109
exportasyncfunctioninit() {
108
110
migrate();
@@ -381,10 +383,9 @@ Behavior rules:
381
383
neither variable is needed and neither is checked
382
384
383
385
Variables consumed through SvelteKit are declared explicitly in `src/env.ts` via
384
-
`defineEnvVars`, enabled by `experimental.explicitEnvironmentVariables` in
385
-
`vite.config.ts`. This is the SvelteKit 3 model, opted into early. Server code
386
-
imports named bindings from `$app/env/private` instead of `$env/dynamic/private`,
387
-
and the latter now throws when imported.
386
+
`defineEnvVars`; SvelteKit 3 detects this declaration file automatically. Server
387
+
code imports named bindings from `$app/env/private` instead of
388
+
`$env/dynamic/private`, and the latter throws when imported.
388
389
389
390
A declared variable is required and non-empty unless its `schema` says otherwise.
390
391
`VERCEL` and `NODE_ENV` are declared optional because each may legitimately be
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
20
20
- Do NOT think 4 steps ahead or add extra features/improvements
21
21
- Only implement the specific change requested
22
22
- You can suggest what the next step could be, but don't implement it
23
-
- For anything that runs from the home route (`/`) in no-backend / Vercel mode, do NOT add top-level imports of backend-only modules like `$lib/api.remote.js` or anything that pulls in `$lib/server/db.js`
23
+
- For anything that runs from the home route (`/`) in no-backend / Vercel mode, do NOT add top-level imports of backend-only modules like `#lib/api.remote.js` or anything that pulls in `#lib/server/db.js`
24
24
- In home-route server files, import backend-only code lazily inside the `has_backend` guard so static/Vercel deployments do not evaluate database code at module load time
Copy file name to clipboardExpand all lines: IMPLEMENTATION_PLAN.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,16 @@
1
1
# Implementation plan
2
2
3
+
## SvelteKit 3 prerelease migration
4
+
5
+
- Upgrade to `@sveltejs/kit@3.0.0-next.12`, TypeScript 6, and SvelteKit-3-compatible prerelease versions of the Node and Vercel adapters while retaining compatible Svelte, Vite, and Vite plugin ranges.
6
+
- Delete `svelte.config.js`; keep all framework and compiler configuration in the `sveltekit()` Vite plugin.
7
+
- Replace generated `$lib` imports with a package `#lib` subpath alias declared in `package.json`.
8
+
- Replace deprecated `invalidateAll()` calls with `refreshAll()`.
9
+
- Pass the current pathname explicitly to the page-browser remote query because SvelteKit 3 forbids reading `event.url` inside queries.
10
+
- Update dynamic `$app/paths.resolve` calls to use SvelteKit 3 pathname inputs without a leading slash, while retaining route ids for known routes.
11
+
- Preserve canonical metadata through Editable's explicit `ORIGIN` variable, and configure Node deployments to trust `x-forwarded-proto` and `x-forwarded-host` now that adapter-node no longer reads `ORIGIN`.
12
+
- Validate with `pnpm check`, `pnpm build`, and a Vercel-mode build; do not run the test suite automatically.
13
+
3
14
## TypeScript conversion
4
15
5
16
Convert the whole codebase from JS+JSDoc to TypeScript per the "Language: TypeScript" section in [ARCHITECTURE.md](ARCHITECTURE.md). Non-strict; svelte-check must stay at 0 errors.
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ Pass those paths to primitives and use the same paths to read values when layout
126
126
<script lang="ts">
127
127
import { get_svedit_context } from '../svedit_context.js';
128
128
import type { DocumentPath } from 'svedit';
129
-
import type { Nodes } from '$lib/document_schema.js';
129
+
import type { Nodes } from '#lib/document_schema.js';
130
130
131
131
const svedit = get_svedit_context();
132
132
let { path }: { path: DocumentPath } = $props();
@@ -589,7 +589,7 @@ Create `src/routes/components/Hero.svelte`. It reads the node at `path`, renders
589
589
<script lang="ts">
590
590
import { Node, TextProperty } from 'svedit';
591
591
import type { DocumentPath } from 'svedit';
592
-
import type { Nodes } from '$lib/document_schema.js';
592
+
import type { Nodes } from '#lib/document_schema.js';
593
593
import { get_svedit_context } from '../svedit_context.js';
594
594
import MediaProperty from './MediaProperty.svelte';
595
595
import { TW_LIMITER, TW_PAGE_PADDING_X } from '../tailwind_theme.js';
@@ -712,7 +712,7 @@ fly secrets set \
712
712
ADMIN_PASSWORD='pick-a-strong-password'
713
713
```
714
714
715
-
`ORIGIN`must exactly match the URL you use in the browser, including the scheme and subdomain (for example, `https://example.com` and `https://www.example.com` are different origins). An incorrect value causes login and other write requests to fail with `403 Forbidden` before the password is checked. Update this secret whenever you switch to a custom domain, and access the site through that canonical URL.
715
+
`ORIGIN`should exactly match the canonical URL you use in the browser, including the scheme and subdomain (for example, `https://example.com` and `https://www.example.com` are different origins), so generated canonical and social metadata stays correct. Update this secret whenever you switch to a custom domain.
716
716
717
717
Optionally set `ASSET_GRACE_PERIOD_DAYS` (default 7): unreferenced asset files are kept on disk this many days after losing their last reference. This is also the safe window for rolling back a database backup against the live assets folder without ending up with dead image references.
0 commit comments