Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe improve types documentation a bit #7003

Merged
merged 60 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
dab0f1f
throwing some ideas at the wall
Rich-Harris Sep 23, 2022
c49ec21
Merge branch 'master' into better-docs
dummdidumm Oct 20, 2022
1fe38a5
better doc visuals from interface definitions
dummdidumm Oct 20, 2022
74eb49b
Merge branch 'master' into better-docs
dummdidumm Nov 16, 2022
6a0bdae
move types representation
dummdidumm Nov 16, 2022
234b7bc
tweak visuals
dummdidumm Nov 16, 2022
522e3f9
silence type error
dummdidumm Nov 16, 2022
4468864
please?
dummdidumm Nov 16, 2022
047c1bd
why don't I get these errors locally
dummdidumm Nov 16, 2022
b156b47
boxes
dummdidumm Nov 17, 2022
0fdda38
border-radius
dummdidumm Nov 17, 2022
e575326
Merge branch 'master' into better-docs
dummdidumm Nov 23, 2022
289569f
auto-prepend "ignore any", remove jsdoc types hack which wrecks jsdoc…
dummdidumm Nov 23, 2022
aceb7f5
remove this file in case we forget later
Rich-Harris Nov 23, 2022
24c70f6
visually group things more tightly
Rich-Harris Nov 23, 2022
f18fb7e
collapse interface blocks
Rich-Harris Nov 23, 2022
0b49e98
dont run twoslash on ts blocks
Rich-Harris Nov 23, 2022
4640f02
add links, fix some css
Rich-Harris Nov 23, 2022
3fa65b0
minor fixes
Rich-Harris Nov 23, 2022
d84b455
config types
Rich-Harris Nov 23, 2022
49e97b0
remove unused code
Rich-Harris Nov 23, 2022
49b00be
merge
Rich-Harris Nov 23, 2022
0553e19
move type extraction script as a precursor to reducing some of the in…
Rich-Harris Nov 23, 2022
2d92e06
distinguish between ts and dts
Rich-Harris Nov 23, 2022
b21ea45
hopefully fix deploy
Rich-Harris Nov 23, 2022
8c6f571
consistent format
Rich-Harris Nov 23, 2022
577823d
reduce indirection a bit
Rich-Harris Nov 24, 2022
5865ae0
nested properties, albeit with terrible styling at the moment
Rich-Harris Nov 24, 2022
de83396
more docs
dummdidumm Nov 24, 2022
e0ec45e
Merge branch 'better-docs' of https://github.com/sveltejs/kit into be…
dummdidumm Nov 24, 2022
6846f2e
improve styles a tiny bit
Rich-Harris Nov 24, 2022
096b0b5
Merge branch 'better-docs' of github.com:sveltejs/kit into better-docs
Rich-Harris Nov 24, 2022
1c39256
flesh out some stuff
Rich-Harris Nov 24, 2022
f2e4799
more stuff
Rich-Harris Nov 24, 2022
f7dab3b
couple more
Rich-Harris Nov 24, 2022
b2e5d17
move SubmitFunction into @sveltejs/kit types
Rich-Harris Nov 24, 2022
bf701a6
use /// type, so type hints get syntax highlighting
Rich-Harris Nov 24, 2022
f6724ac
add some defaults
Rich-Harris Nov 26, 2022
f2bff6c
merge master
Rich-Harris Nov 27, 2022
c21c88c
more defaults
Rich-Harris Nov 27, 2022
7f3c273
remove unused typedef
Rich-Harris Nov 27, 2022
8af5687
consistency
Rich-Harris Nov 27, 2022
3730ec1
fix code snippet
Rich-Harris Nov 27, 2022
39388aa
small tweaks
Rich-Harris Nov 27, 2022
04de262
small fixes
Rich-Harris Nov 27, 2022
866ae0a
tweaks
Rich-Harris Nov 27, 2022
70f2dd7
rename API reference to just reference
Rich-Harris Nov 27, 2022
27cc46e
okay ts doesnt like that
Rich-Harris Nov 28, 2022
f501b45
missed a spot
Rich-Harris Nov 28, 2022
f54eae6
changeset
Rich-Harris Nov 28, 2022
44ae150
fix link
Rich-Harris Nov 28, 2022
8c578dd
refactor code in the direction of separating out config reference
Rich-Harris Nov 28, 2022
063ca96
remove unused code
Rich-Harris Nov 28, 2022
7aac7a8
systematise some stuff
Rich-Harris Nov 28, 2022
0174f5e
generate config docs
Rich-Harris Nov 28, 2022
15b281c
get site building again
Rich-Harris Nov 28, 2022
51ca4f5
hackiest possible workaround
Rich-Harris Nov 28, 2022
a9e30f4
merge master
Rich-Harris Nov 28, 2022
cf949ca
tweak some css
Rich-Harris Nov 28, 2022
0ed36e1
tweaks
Rich-Harris Nov 28, 2022
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
5 changes: 5 additions & 0 deletions .changeset/bright-pianos-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Update app.d.ts files
5 changes: 5 additions & 0 deletions .changeset/light-toes-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Add more type documentation
5 changes: 5 additions & 0 deletions .changeset/young-needles-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[breaking] move SubmitFunction into @sveltejs/kit
4 changes: 2 additions & 2 deletions documentation/docs/20-core-concepts/20-load.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export async function load({ fetch, params }) {

### Cookies and headers

A server-only `load` function can get and set [`cookies`](/docs/types#sveltejs-kit-cookies).
A server-only `load` function can get and set [`cookies`](/docs/types#public-types-cookies).

```js
/// file: src/routes/+layout.server.js
Expand Down Expand Up @@ -544,7 +544,7 @@ To summarize, a `load` function will re-run in the following situations:
- It references a property of `params` whose value has changed
- It references a property of `url` (such as `url.pathname` or `url.search`) whose value has changed
- It calls `await parent()` and a parent `load` function re-ran
- It declared a dependency on a specific URL via [`fetch`](#making-fetch-requests) or [`depends`](/docs/types#sveltejs-kit-loadevent), and that URL was marked invalid with [`invalidate(url)`](/docs/modules#$app-navigation-invalidate)
- It declared a dependency on a specific URL via [`fetch`](#making-fetch-requests) or [`depends`](/docs/types#public-types-loadevent), and that URL was marked invalid with [`invalidate(url)`](/docs/modules#$app-navigation-invalidate)
- All active `load` functions were forcibly re-run with [`invalidateAll()`](/docs/modules#$app-navigation-invalidateall)

Note that re-running a `load` function will update the `data` prop inside the corresponding `+layout.svelte` or `+page.svelte`; it does _not_ cause the component to be recreated. As a result, internal state is preserved. If this isn't what you want, you can reset whatever you need to reset inside an [`afterNavigate`](/docs/modules#$app-navigation-afternavigate) callback, and/or wrap your component in a [`{#key ...}`](https://svelte.dev/docs#template-syntax-key) block.
Expand Down
10 changes: 5 additions & 5 deletions documentation/docs/30-advanced/70-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ When you're creating an app, the contents of `src/routes` is the public-facing s

A component library has the exact same structure as a SvelteKit app, except that `src/lib` is the public-facing bit. `src/routes` might be a documentation or demo site that accompanies the library, or it might just be a sandbox you use during development.

Running the `svelte-package` command from `@sveltejs/package` will take the contents of `src/lib` and generate a `package` directory (which can be [configured](/docs/configuration#package)) containing the following:
Running the `svelte-package` command from `@sveltejs/package` will take the contents of `src/lib` and generate a `package` directory (which can be [configured](/docs/configuration)) containing the following:

- All the files in `src/lib`, unless you [configure](/docs/configuration#package) custom `include`/`exclude` options. Svelte components will be preprocessed, TypeScript files will be transpiled to JavaScript.
- Type definitions (`d.ts` files) which are generated for Svelte, JavaScript and TypeScript files. You need to install `typescript >= 4.0.0` for this. Type definitions are placed next to their implementation, hand-written `d.ts` files are copied over as is. You can [disable generation](/docs/configuration#package), but we strongly recommend against it.
- All the files in `src/lib`, unless you [configure](/docs/configuration) custom `include`/`exclude` options. Svelte components will be preprocessed, TypeScript files will be transpiled to JavaScript.
- Type definitions (`d.ts` files) which are generated for Svelte, JavaScript and TypeScript files. You need to install `typescript >= 4.0.0` for this. Type definitions are placed next to their implementation, hand-written `d.ts` files are copied over as is. You can [disable generation](/docs/configuration), but we strongly recommend against it.
- A `package.json` copied from the project root with all fields except `"scripts"`, `"publishConfig.directory"` and `"publishConfig.linkDirectory"`. The `"dependencies"` field is included, which means you should add packages that you only need for your documentation or demo site to `"devDependencies"`. A `"type": "module"` and an `"exports"` field will be added if it's not defined in the original file.

The `"exports"` field contains the package's entry points. By default, all files in `src/lib` will be treated as an entry point unless they start with (or live in a directory that starts with) an underscore, but you can [configure](/docs/configuration#package) this behaviour. If you have a `src/lib/index.js` or `src/lib/index.svelte` file, it will be treated as the package root.
The `"exports"` field contains the package's entry points. By default, all files in `src/lib` will be treated as an entry point unless they start with (or live in a directory that starts with) an underscore, but you can [configure](/docs/configuration) this behaviour. If you have a `src/lib/index.js` or `src/lib/index.svelte` file, it will be treated as the package root.

For example, if you had a `src/lib/Foo.svelte` component and a `src/lib/index.js` module that re-exported it, a consumer of your library could do either of the following:

Expand Down Expand Up @@ -54,7 +54,7 @@ To publish the generated package:
npm publish ./package
```

The `./package` above is referring to the directory name generated, change accordingly if you configure a custom [`package.dir`](/docs/configuration#package).
The `./package` above is referring to the directory name generated, change accordingly if you configure a custom [`package.dir`](/docs/configuration).

### Caveats

Expand Down
307 changes: 0 additions & 307 deletions documentation/docs/50-api-reference/10-configuration.md

This file was deleted.

3 changes: 0 additions & 3 deletions documentation/docs/50-api-reference/meta.json

This file was deleted.

Loading