Skip to content

Commit

Permalink
chore(deps): update @shikijs/vitepress-twoslash to 1.5.0 (#16637)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed May 10, 2024
1 parent 22dc196 commit 4501b5a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 55 deletions.
3 changes: 1 addition & 2 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ type ResolveModulePreloadDependenciesFn = (
The `resolveDependencies` function will be called for each dynamic import with a list of the chunks it depends on, and it will also be called for each chunk imported in entry HTML files. A new dependencies array can be returned with these filtered or more dependencies injected, and their paths modified. The `deps` paths are relative to the `build.outDir`. Returning a relative path to the `hostId` for `hostType === 'js'` is allowed, in which case `new URL(dep, import.meta.url)` is used to get an absolute path when injecting this module preload in the HTML head.
<!-- prettier-ignore-start -->
```js twoslash
/** @type {import('vite').UserConfig} */
const config = {
// prettier-ignore
build: {
// ---cut-before---
modulePreload: {
Expand All @@ -63,7 +63,6 @@ modulePreload: {
},
}
```
<!-- prettier-ignore-end -->

The resolved dependency paths can be further modified using [`experimental.renderBuiltUrl`](../guide/build.md#advanced-base-options).

Expand Down
6 changes: 2 additions & 4 deletions docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ A user may choose to deploy in three different paths:

A single static [base](#public-base-path) isn't enough in these scenarios. Vite provides experimental support for advanced base options during build, using `experimental.renderBuiltUrl`.

<!-- prettier-ignore-start -->
```ts twoslash
import type { UserConfig } from 'vite'
// prettier-ignore
const config: UserConfig = {
// ---cut-before---
experimental: {
Expand All @@ -255,14 +255,13 @@ experimental: {
// ---cut-after---
}
```
<!-- prettier-ignore-end -->

If the hashed assets and public files aren't deployed together, options for each group can be defined independently using asset `type` included in the second `context` param given to the function.

<!-- prettier-ignore-start -->
```ts twoslash
import type { UserConfig } from 'vite'
import path from 'node:path'
// prettier-ignore
const config: UserConfig = {
// ---cut-before---
experimental: {
Expand All @@ -279,6 +278,5 @@ experimental: {
// ---cut-after---
}
```
<!-- prettier-ignore-end -->

Note that the `filename` passed is a decoded URL, and if the function returns a URL string, it should also be decoded. Vite will handle the encoding automatically when rendering the URLs. If an object with `runtime` is returned, encoding should be handled yourself where needed as the runtime code will be rendered as is.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"docs-serve": "vitepress serve"
},
"devDependencies": {
"@shikijs/vitepress-twoslash": "^1.4.0",
"@shikijs/vitepress-twoslash": "^1.5.0",
"@types/express": "^4.17.21",
"vitepress": "1.1.4",
"vue": "^3.4.27"
Expand Down
75 changes: 27 additions & 48 deletions pnpm-lock.yaml

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

0 comments on commit 4501b5a

Please sign in to comment.