Skip to content

Commit f2413f7

Browse files
committed
merge main
2 parents 71f8465 + d93eb42 commit f2413f7

File tree

722 files changed

+15845
-7600
lines changed

Some content is hidden

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

722 files changed

+15845
-7600
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"commit": false,
55
"linked": [],
66
"access": "public",
7-
"baseBranch": "master",
7+
"baseBranch": "main",
88
"bumpVersionsWithWorkspaceProtocolOnly": true,
99
"ignore": ["!(@sveltejs/*|create-svelte|svelte-migrate)"]
1010
}

.changeset/mighty-crews-switch.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/pink-sloths-join.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<!-- Your PR description here -->
2+
3+
---
4+
15
### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
26
- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
37
- [ ] This message body should clearly illustrate what problems it solves.
@@ -8,3 +12,7 @@
812

913
### Changesets
1014
- [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.
15+
16+
### Edits
17+
18+
- [ ] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

.github/workflows/audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
Audit:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: pnpm/[email protected]
20-
- uses: actions/setup-node@v3
20+
- uses: actions/setup-node@v4
2121
with:
2222
node-version: '20.x'
2323
cache: pnpm

.github/workflows/ci.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88

99
env:
@@ -22,15 +22,15 @@ jobs:
2222
Lint:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- uses: pnpm/[email protected]
27-
- uses: actions/setup-node@v3
27+
- uses: actions/setup-node@v4
2828
with:
29-
node-version: '16.x'
29+
node-version: '18.x'
3030
cache: pnpm
3131
- run: pnpm install --frozen-lockfile
3232
- run: pnpm run lint
33-
- run: cd packages/kit && pnpm prepublishOnly
33+
- run: cd packages/kit && pnpm prepublishOnly && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please run prepublishOnly locally and commit the changes after you have reviewed them"; git diff; exit 1); }
3434
- run: pnpm run check
3535
Tests:
3636
runs-on: ${{ matrix.os }}
@@ -39,9 +39,6 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
include:
42-
- node-version: 16
43-
os: ubuntu-latest
44-
e2e-browser: 'chromium'
4542
- node-version: 18
4643
os: ubuntu-latest
4744
e2e-browser: 'chromium'
@@ -52,9 +49,9 @@ jobs:
5249
KIT_E2E_BROWSER: ${{matrix.e2e-browser}}
5350
steps:
5451
- run: git config --global core.autocrlf false
55-
- uses: actions/checkout@v3
52+
- uses: actions/checkout@v4
5653
- uses: pnpm/[email protected]
57-
- uses: actions/setup-node@v3
54+
- uses: actions/setup-node@v4
5855
with:
5956
node-version: ${{ matrix.node-version }}
6057
cache: pnpm
@@ -67,7 +64,7 @@ jobs:
6764
run: find packages -type d -name test-results -not -empty | tar -czf test-results.tar.gz --files-from=-
6865
- name: Upload test results
6966
if: failure()
70-
uses: actions/upload-artifact@v3
67+
uses: actions/upload-artifact@v4
7168
with:
7269
retention-days: 3
7370
name: test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
@@ -79,37 +76,37 @@ jobs:
7976
fail-fast: false
8077
matrix:
8178
include:
82-
- node-version: 16
79+
- node-version: 18
8380
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
8481
e2e-browser: 'chromium'
8582
mode: 'dev'
86-
- node-version: 16
83+
- node-version: 18
8784
os: ubuntu-latest
8885
e2e-browser: 'firefox'
8986
mode: 'dev'
90-
- node-version: 16
87+
- node-version: 18
9188
os: macOS-latest
9289
e2e-browser: 'webkit'
9390
mode: 'dev'
94-
- node-version: 16
91+
- node-version: 18
9592
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
9693
e2e-browser: 'chromium'
9794
mode: 'build'
98-
- node-version: 16
95+
- node-version: 18
9996
os: ubuntu-latest
10097
e2e-browser: 'firefox'
10198
mode: 'build'
102-
- node-version: 16
99+
- node-version: 18
103100
os: macOS-latest
104101
e2e-browser: 'webkit'
105102
mode: 'build'
106103
env:
107104
KIT_E2E_BROWSER: ${{matrix.e2e-browser}}
108105
steps:
109106
- run: git config --global core.autocrlf false
110-
- uses: actions/checkout@v3
107+
- uses: actions/checkout@v4
111108
- uses: pnpm/[email protected]
112-
- uses: actions/setup-node@v3
109+
- uses: actions/setup-node@v4
113110
with:
114111
node-version: ${{ matrix.node-version }}
115112
cache: pnpm
@@ -122,19 +119,19 @@ jobs:
122119
run: find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.mode }}.tar.gz --files-from=-
123120
- name: Upload test results
124121
if: failure()
125-
uses: actions/upload-artifact@v3
122+
uses: actions/upload-artifact@v4
126123
with:
127124
retention-days: 3
128125
name: test-failure-cross-platform-${{ matrix.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
129126
path: test-results-cross-platform-${{ matrix.mode }}.tar.gz
130127
Test-create-svelte:
131128
runs-on: ubuntu-latest
132129
steps:
133-
- uses: actions/checkout@v3
130+
- uses: actions/checkout@v4
134131
- uses: pnpm/[email protected]
135-
- uses: actions/setup-node@v3
132+
- uses: actions/setup-node@v4
136133
with:
137-
node-version: 16
134+
node-version: 18
138135
cache: pnpm
139136
- run: pnpm install --frozen-lockfile
140137
- run: cd packages/kit && pnpm prepublishOnly

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77

88
permissions: {}
99
jobs:
@@ -17,13 +17,13 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout Repo
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
with:
2222
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
2323
fetch-depth: 0
2424
- uses: pnpm/[email protected]
2525
- name: Setup Node.js
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
node-version: 16.x
2929
cache: pnpm

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
link-workspace-packages = true
2-
engine-strict = true

.prettierrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"singleQuote": true,
44
"trailingComma": "none",
55
"printWidth": 100,
6+
"plugins": ["prettier-plugin-svelte"],
67
"overrides": [
78
{
89
"files": ["*.svelte"],
@@ -20,6 +21,7 @@
2021
{
2122
"files": [
2223
"**/CHANGELOG.md",
24+
"**/vite.config.js.timestamp-*",
2325
"**/.svelte-kit/**",
2426
"documentation/**/*.md",
2527
"packages/package/test/fixtures/**/expected/**/*",

CONTRIBUTING.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Preparing
44

5-
This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.js.org/en/). You can [install pnpm](https://pnpm.io/installation) with:
5+
This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.io/). You can [install pnpm](https://pnpm.io/installation) with:
66

77
```bash
88
npm i -g pnpm
@@ -16,32 +16,40 @@ cd kit
1616
pnpm install
1717
```
1818

19-
You can now run SvelteKit by linking it into your project with [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides):
19+
## Testing Changes
20+
21+
### Playground
22+
23+
You can use the playground at [`playgrounds/basic`](./playgrounds/basic/) to experiment with your changes to SvelteKit locally.
24+
25+
### Linking
26+
27+
If you want to test against an existing project, you can use [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides) in that project:
2028

2129
```jsonc
2230
{
23-
// ...
24-
"pnpm": {
25-
"overrides": {
26-
"@sveltejs/kit": "link:../path/to/svelte-kit/packages/kit",
27-
// additionally/optional the adapter you're using
28-
"@sveltejs/adapter-auto": "link:../path/to/svelte-kit/packages/adapter-auto"
29-
}
30-
}
31+
// ...
32+
"pnpm": {
33+
"overrides": {
34+
"@sveltejs/kit": "link:../path/to/svelte-kit/packages/kit",
35+
// additionally/optional the adapter you're using
36+
"@sveltejs/adapter-auto": "link:../path/to/svelte-kit/packages/adapter-auto"
37+
}
38+
}
3139
}
3240
```
3341

3442
## Code structure
3543

3644
Entry points to be aware of are:
3745

38-
- [`packages/create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) - code that's run when you create a new project with `npm create svelte@latest`
39-
- [`packages/package`](https://github.com/sveltejs/kit/tree/master/packages/package) - for the `svelte-package` command
40-
- [`packages/kit/src/core`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/core) - code that's called at dev/build-time
41-
- [`packages/kit/src/core/sync`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/core/sync) - for `svelte-kit sync`, which regenerates routing info and type definitions
42-
- [`packages/kit/src/runtime`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/runtime) - code that's called at runtime
43-
- [`packages/kit/src/exports/vite`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/exports/vite) - for all the Vite plugin related stuff
44-
- [`packages/adapter-[platform]`](https://github.com/sveltejs/kit/tree/master/packages) - for the various SvelteKit-provided adapters
46+
- [`packages/create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte) - code that's run when you create a new project with `npm create svelte@latest`
47+
- [`packages/package`](https://github.com/sveltejs/kit/tree/main/packages/package) - for the `svelte-package` command
48+
- [`packages/kit/src/core`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/core) - code that's called at dev/build-time
49+
- [`packages/kit/src/core/sync`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/core/sync) - for `svelte-kit sync`, which regenerates routing info and type definitions
50+
- [`packages/kit/src/runtime`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/runtime) - code that's called at runtime
51+
- [`packages/kit/src/exports/vite`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/exports/vite) - for all the Vite plugin related stuff
52+
- [`packages/adapter-[platform]`](https://github.com/sveltejs/kit/tree/main/packages) - for the various SvelteKit-provided adapters
4553

4654
## Good first issues
4755

@@ -79,21 +87,21 @@ If you would like to test local changes to Vite or another dependency, you can b
7987

8088
```jsonc
8189
{
82-
// ...
83-
"dependencies": {
84-
"vite": "^4.0.0"
85-
},
86-
"pnpm": {
87-
"overrides": {
88-
"vite": "link:../path/to/vite/packages/vite"
89-
}
90-
}
90+
// ...
91+
"dependencies": {
92+
"vite": "^4.0.0"
93+
},
94+
"pnpm": {
95+
"overrides": {
96+
"vite": "link:../path/to/vite/packages/vite"
97+
}
98+
}
9199
}
92100
```
93101

94102
## Documentation changes
95103

96-
All documentation for SvelteKit is in the [`documentation` directory](https://github.com/sveltejs/kit/tree/master/documentation), and any improvements should be made as a Pull Request to this repository. The site itself is located in the [`sites/kit.svelte.dev` directory](https://github.com/sveltejs/kit/tree/master/sites/kit.svelte.dev) and can be run locally to preview changes.
104+
All documentation for SvelteKit is in the [`documentation` directory](https://github.com/sveltejs/kit/tree/main/documentation), and any improvements should be made as a Pull Request to this repository. The site itself is located in the [`sites/kit.svelte.dev` directory](https://github.com/sveltejs/kit/tree/main/sites/kit.svelte.dev) and can be run locally to preview changes.
97105

98106
## Sending PRs
99107

@@ -116,6 +124,10 @@ git config core.hookspath .githooks
116124

117125
For changes to be reflected in package changelogs, run `pnpm changeset` and follow the prompts.
118126

127+
### Type changes
128+
129+
If your PR changes the generated types of SvelteKit, run `pnpm generate:types` inside `packages/kit` and commit the new output (don't format it with Prettier!). Review the changes carefully to ensure there are no unwanted changes. If you don't commit type changes, CI will fail.
130+
119131
## Releases
120132

121133
The [Changesets GitHub action](https://github.com/changesets/action#with-publishing) will create and update a PR that applies changesets and publishes new versions of changed packages to npm.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ Web development, streamlined. Read the [documentation](https://kit.svelte.dev/do
1717
| [@sveltejs/adapter-static](packages/adapter-static) | [Changelog](packages/adapter-static/CHANGELOG.md) |
1818
| [@sveltejs/adapter-vercel](packages/adapter-vercel) | [Changelog](packages/adapter-vercel/CHANGELOG.md) |
1919
| [@sveltejs/amp](packages/amp) | [Changelog](packages/amp/CHANGELOG.md) |
20+
| [@sveltejs/enhanced-img](packages/enhanced-img) | [Changelog](packages/enhanced-img/CHANGELOG.md) |
2021
| [@sveltejs/package](packages/package) | [Changelog](packages/package/CHANGELOG.md) |
2122
| [create-svelte](packages/create-svelte) | [Changelog](packages/create-svelte/CHANGELOG.md) |
2223
| [svelte-migrate](packages/migrate) | [Changelog](packages/migrate/CHANGELOG.md) |
2324

24-
[Additional adapters](<(https://sveltesociety.dev/components#adapters)>) are maintained by the community.
25+
[Additional adapters](https://sveltesociety.dev/packages?category=sveltekit-adapters) are maintained by the community.
2526

2627
## Bug reporting
2728

@@ -43,4 +44,4 @@ Funds donated via Open Collective will be used for compensating expenses related
4344

4445
## License
4546

46-
[MIT](https://github.com/sveltejs/kit/blob/master/LICENSE)
47+
[MIT](https://github.com/sveltejs/kit/blob/main/LICENSE)

documentation/docs/10-getting-started/10-introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ title: Introduction
1212

1313
SvelteKit is a framework for rapidly developing robust, performant web applications using [Svelte](https://svelte.dev/). If you're coming from React, SvelteKit is similar to Next. If you're coming from Vue, SvelteKit is similar to Nuxt.
1414

15-
To learn more about the kinds of applications you can build with SvelteKit, see the [FAQ](/faq#what-can-i-make-with-sveltekit).
15+
To learn more about the kinds of applications you can build with SvelteKit, see the [FAQ](/docs/faq#what-can-i-make-with-sveltekit).
1616

1717
## What is Svelte?
1818

@@ -22,6 +22,6 @@ In short, Svelte is a way of writing user interface components — like a naviga
2222

2323
Svelte renders UI components. You can compose these components and render an entire page with just Svelte, but you need more than just Svelte to write an entire app.
2424

25-
SvelteKit provides basic functionality like a [router](glossary#routing) — which updates the UI when a link is clicked — and [server-side rendering (SSR)](glossary#ssr). But beyond that, building an app with all the modern best practices is fiendishly complicated. Those practices include [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations), so that you load only the minimal required code; [offline support](service-workers); [preloading](link-options#data-sveltekit-preload-data) pages before the user initiates navigation; [configurable rendering](page-options) that allows you to render different parts of your app on the server with [SSR](glossary#ssr), in the browser [client-side rendering](glossary#csr), or at build-time with [prerendering](glossary#prerendering); and many other things. SvelteKit does all the boring stuff for you so that you can get on with the creative part.
25+
SvelteKit helps you build web apps while following modern best practices and providing solutions to common development challenges. It offers everything from basic functionalities — like a [router](glossary#routing) that updates your UI when a link is clicked — to more advanced capabilities. Its extensive list of features includes [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations) to load only the minimal required code; [offline support](service-workers); [preloading](link-options#data-sveltekit-preload-data) pages before user navigation; [configurable rendering](page-options) to handle different parts of your app on the server via [SSR](glossary#ssr), in the browser through [client-side rendering](glossary#csr), or at build-time with [prerendering](glossary#prerendering); [image optimization](images); and much more. Building an app with all the modern best practices is fiendishly complicated, but SvelteKit does all the boring stuff for you so that you can get on with the creative part.
2626

2727
It reflects changes to your code in the browser instantly to provide a lightning-fast and feature-rich development experience by leveraging [Vite](https://vitejs.dev/) with a [Svelte plugin](https://github.com/sveltejs/vite-plugin-svelte) to do [Hot Module Replacement (HMR)](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#hot).

documentation/docs/10-getting-started/20-creating-a-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ npm install
1111
npm run dev
1212
```
1313

14-
The first command will scaffold a new project in the `my-app` directory asking you if you'd like to set up some basic tooling such as TypeScript. See the FAQ for [pointers on setting up additional tooling](../faq#integrations). The subsequent commands will then install its dependencies and start a server on [localhost:5173](http://localhost:5173).
14+
The first command will scaffold a new project in the `my-app` directory asking you if you'd like to set up some basic tooling such as TypeScript. See [integrations](./integrations) for pointers on setting up additional tooling. The subsequent commands will then install its dependencies and start a server on [localhost:5173](http://localhost:5173).
1515

1616
There are two basic concepts:
1717

@@ -22,4 +22,4 @@ Try editing the files to get a feel for how everything works.
2222

2323
## Editor setup
2424

25-
We recommend using [Visual Studio Code (aka VS Code)](https://code.visualstudio.com/download) with [the Svelte extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), but [support also exists for numerous other editors](https://sveltesociety.dev/tools#editor-support).
25+
We recommend using [Visual Studio Code (aka VS Code)](https://code.visualstudio.com/download) with [the Svelte extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), but [support also exists for numerous other editors](https://sveltesociety.dev/resources#editor-support).

documentation/docs/10-getting-started/30-project-structure.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ my-project/
1818
│ ├ app.html
1919
│ ├ error.html
2020
│ ├ hooks.client.js
21-
│ └ hooks.server.js
21+
│ ├ hooks.server.js
22+
│ └ service-worker.js
2223
├ static/
2324
│ └ [your static assets]
2425
├ tests/

0 commit comments

Comments
 (0)