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

feat: v6 - Environment API #16471

Draft
wants to merge 133 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
b41895c
docs: environment API migration guide stub
patak-dev Apr 19, 2024
f684d4c
feat: environment api (#16129)
patak-dev Apr 19, 2024
777967d
docs: Environment API (#16089)
patak-dev Apr 19, 2024
ad2b0bf
chore: remove configureServer from more plugins
patak-dev Apr 19, 2024
5f6b62f
chore: rename plugin.split to plugin.create
patak-dev Apr 19, 2024
431cd4b
fix: export missing types
patak-dev Apr 19, 2024
635aad5
release: v6.0.0-alpha.3
patak-dev Apr 20, 2024
d7c6fc4
docs: Environment(name, config) update
patak-dev Apr 20, 2024
1904acd
docs: remove alternatives section from the docs, better to keep that …
patak-dev Apr 20, 2024
d4b155c
docs: update to latest implementation
patak-dev Apr 20, 2024
5c5efe4
fix(v6): fix `ssrEmitAssets` compat (#16480)
hi-ogawa Apr 21, 2024
2a3bcb3
chore: merge main
patak-dev Apr 22, 2024
29dd26e
refactor: build --app
patak-dev Apr 22, 2024
33ef0fb
fix: disable hmr for ssrLoadModule
sheremet-va Apr 22, 2024
bf65476
chore: remove the deprecation notice from ssrLoadModule for now
sheremet-va Apr 22, 2024
9d6a152
refactor: remove server from createServerModuleRunner
sheremet-va Apr 22, 2024
7099e12
docs: create plugin hook
patak-dev Apr 24, 2024
4cf322d
fix(cli): ->
patak-dev Apr 26, 2024
4dc2a75
refactor: rename createViteBuilder to createBuilder, align with creat…
patak-dev Apr 26, 2024
41a95ae
chore: lint
patak-dev Apr 26, 2024
8843221
feat: use environment.logger in buildEnvironment
patak-dev Apr 26, 2024
62921e6
refactor: align createBuilder params with createServer
patak-dev Apr 26, 2024
294a84e
fix: backcompat merging
patak-dev Apr 26, 2024
2866d4f
feat: opt-in shared plugins during build
patak-dev Apr 26, 2024
a63190c
fix: sharedPlugins
patak-dev Apr 26, 2024
1925eeb
feat: builder.entireApp, remove --environment
patak-dev Apr 26, 2024
72150d6
fix: rework backcompat patching of environment config
patak-dev Apr 26, 2024
064f747
chore: merge main
patak-dev Apr 26, 2024
e6fa9d9
release: v6.0.0-alpha.4
patak-dev Apr 26, 2024
a44810a
fix: use environment.plugins during build, support create hook
patak-dev Apr 26, 2024
a8adcac
release: v6.0.0-alpha.5
patak-dev Apr 26, 2024
00079da
fix: custom environment preload injection (#16541)
hi-ogawa Apr 28, 2024
e8473a6
release: v6.0.0-alpha.6
patak-dev Apr 28, 2024
a6fc1dd
feat: this.environment in renderChunk and generateBundle
patak-dev Apr 29, 2024
8231283
feat: remove config.build from dynamicImportVars plugin
patak-dev Apr 29, 2024
bda0dc5
feat: this.environment in buildStart, rework more internal plugins
patak-dev Apr 29, 2024
05943cf
release: v6.0.0-alpha.7
patak-dev Apr 29, 2024
7566aae
feat: define and html plugins
patak-dev Apr 29, 2024
30b2da7
docs: environment.config -> environment.options
patak-dev Apr 29, 2024
527621e
refactor: environment hooks guard
patak-dev Apr 29, 2024
12d467f
fix: keep plugins with create hook
patak-dev Apr 30, 2024
1d9caef
release: v6.0.0-alpha.8
patak-dev Apr 30, 2024
f6dce10
chore: update
patak-dev May 1, 2024
1bcb67d
refactor: move reload on tsconfig change to the server
patak-dev May 1, 2024
6b74221
refactor: bounded plugins factory instead of create hook
patak-dev May 1, 2024
b8ef8ff
fix: module-runner bundle issue with chokidar dep
patak-dev May 1, 2024
d54a88e
chore: merge main
patak-dev May 1, 2024
a09353e
chore: fix lock
patak-dev May 1, 2024
848af54
fix: lint
patak-dev May 1, 2024
2e6abb3
release: v6.0.0-alpha.9
patak-dev May 1, 2024
d213865
feat: sharedDuringBuild for bounded plugins
patak-dev May 2, 2024
57871a4
release: v6.0.0-alpha.10
patak-dev May 2, 2024
35d2d87
docs: shared during build plugins
patak-dev May 2, 2024
1ec07a4
refactor: BoundedPlugin -> IsolatedPlugin
patak-dev May 2, 2024
cf9a79c
chore: merge main
patak-dev May 2, 2024
372a3ad
chore: merge main
patak-dev May 4, 2024
8851d9d
release: v6.0.0-alpha.11
patak-dev May 4, 2024
ffb4aa7
docs: add a note about the "run" method
sheremet-va May 9, 2024
0b3cf69
chore: export ssrTransform
sheremet-va May 20, 2024
a5efd56
fix: remove enforce inside IsolatedPlugins
patak-dev May 20, 2024
8c5674e
chore: respect ssr flag in clientInjectsions transform
patak-dev May 20, 2024
371f7a0
release: v6.0.0-alpha.12
patak-dev May 20, 2024
82111bf
fix: types
patak-dev May 20, 2024
2ae2fca
release: v6.0.0-alpha.13
patak-dev May 20, 2024
3546d1e
fix: revert resolveId importer require
sheremet-va May 20, 2024
34d8518
fix: export isFileLoadingAllowed
sheremet-va May 20, 2024
8ee7fcd
fix: rely on the current environment in resolveId, if known
sheremet-va May 20, 2024
54c219e
feat: back to environmentPlugins hook (#16732)
patak-dev May 20, 2024
3f30147
chore: merge main
patak-dev May 20, 2024
2b2d010
release: v6.0.0-alpha.14
patak-dev May 20, 2024
acb208e
fix hmr connected message on client
ArnaudBarre May 20, 2024
7e9dd25
fix: only join base url in none ssr env
antfu May 20, 2024
0166bfe
fix: svelte back compat
patak-dev May 20, 2024
d231966
release: v6.0.0-alpha.15
patak-dev May 20, 2024
46f21b8
fix: back compat for server.pluginContainer.buildStart
patak-dev May 20, 2024
431455f
chore: remove extra symbol
sheremet-va May 21, 2024
63de43a
fix: keep plugin with environmentPlugins hook
patak-dev May 21, 2024
21225c9
feat: improve Plugin option types
patak-dev May 21, 2024
53734a8
feat: provide `environment` in every hook context
antfu May 21, 2024
89ec69c
fix: argument rollup types for plugin context instead of wrapping
antfu May 21, 2024
a3ee7f5
fix: avoid duplicating values in shared optimizeDeps config (#16737)
dominikg May 21, 2024
4d03124
feat(types): expose PluginEnvironment type
antfu May 22, 2024
d86553a
chore: rename to BaseEnvironment (#16797)
ArnaudBarre May 23, 2024
e36f2f3
feat: only shared plugins (#17289)
patak-dev May 23, 2024
778e39d
fix: backcompat with config.optimizeDeps
patak-dev May 23, 2024
bcb1959
feat: createWeakData
patak-dev May 23, 2024
c7d02ac
release: v6.0.0-alpha.16
patak-dev May 23, 2024
478a9aa
fix: optimizeDeps back compat
patak-dev May 23, 2024
006cfb7
feat: per-environment optimizeDeps entries and force
patak-dev May 23, 2024
5f36aa6
chore: refactor isDepsOptimizerEnabled
patak-dev May 23, 2024
2b69389
feat: reporter as shared plugin using createWeakData (#17293)
patak-dev May 23, 2024
e339959
fix(types): avoid referencing `WeakKey` type
antfu May 24, 2024
11bddb0
fix: handleHotUpdate compat (#17295)
patak-dev May 24, 2024
5c655e6
fix: DepOptimizationConfig
patak-dev May 24, 2024
624e751
fix: dep optimization options
patak-dev May 24, 2024
87bbb04
refactor!: rename to HMRPayload to HotPayload and remove HMRBroadcast…
ArnaudBarre May 24, 2024
09a032e
chore: merge main
patak-dev May 24, 2024
e45881c
release: v6.0.0-alpha.17
patak-dev May 24, 2024
c43c987
refactor: reporter using custom per env api (#17297)
patak-dev May 24, 2024
398a49c
feat(types): `defineVitePlugin` utils (#17298)
antfu May 24, 2024
909fe28
fix: lastHMRTimestamp compat
patak-dev May 24, 2024
b7cbd3d
fix: missing HMRPayload export
ArnaudBarre May 24, 2024
bdd1b91
feat: non-nullable this.environment (#17302)
patak-dev May 24, 2024
611ce5c
fix: check lastHMRTimestamp for entries in moduleRunner
sheremet-va May 24, 2024
d8aa74c
docs: assign code for each deprecation changes, provide option to opt…
antfu May 25, 2024
ca940e8
chore: refactor code style
antfu May 25, 2024
1af7081
chore: ignore test-dts in tsconfig
antfu May 25, 2024
7d78761
test(v6): test ssrLoadModule and virtual module invalidation (#17313)
hi-ogawa May 25, 2024
fd46a2a
fix: correctly invalidate module in the module runner if it was inval…
sheremet-va May 25, 2024
e91e269
fix: check last invalidation time
sheremet-va May 25, 2024
da354ea
fix: default value of `depOptimization`
antfu May 25, 2024
5b76647
chore: typo
antfu May 26, 2024
754bcef
Merge branch 'main' into v6/environment-api
antfu May 28, 2024
03bc590
fix: improve invalidation sync in the module runner
sheremet-va May 28, 2024
a63263c
fix: do not invalidate modules in the runner if not invalidated on th…
sheremet-va May 28, 2024
28e22c6
chore: cleanup
sheremet-va May 28, 2024
c373251
chore: prettier
sheremet-va May 28, 2024
909782f
refactor: plugin container (#17288)
antfu May 29, 2024
6ebb7b9
chore: merge
antfu May 29, 2024
2b3329d
chore: fix build
antfu May 29, 2024
97bfcd2
docs: update
patak-dev Jun 3, 2024
169dd12
docs: update
patak-dev Jun 3, 2024
7fd9596
docs: update
patak-dev Jun 3, 2024
630a75a
docs: update
patak-dev Jun 3, 2024
ef87aa2
docs: update
patak-dev Jun 3, 2024
1f163bf
docs: update
patak-dev Jun 3, 2024
8649049
docs: update
patak-dev Jun 3, 2024
217b2f4
docs: add more context before jumping into details
patak-dev Jun 3, 2024
ec90bd3
docs: update
patak-dev Jun 3, 2024
1e07003
docs: typo
patak-dev Jun 3, 2024
3635ed8
feat: expose createIdResolver
patak-dev Jun 4, 2024
bfe2670
chore: merge main
patak-dev Jun 4, 2024
bbca0b4
release: v6.0.0-alpha.18
patak-dev Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ export default defineConfig({
link: '/guide/api-javascript',
},
{
text: 'Vite Runtime API',
link: '/guide/api-vite-runtime',
text: 'Vite Environment API',
link: '/guide/api-vite-environment',
},
{
text: 'Config Reference',
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/announcing-vite5-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ The new API brings many benefits:

The initial idea [was proposed by Pooya Parsa](https://github.com/nuxt/vite/pull/201) and implemented by [Anthony Fu](https://github.com/antfu) as the [vite-node](https://github.com/vitest-dev/vitest/tree/main/packages/vite-node#readme) package to [power Nuxt 3 Dev SSR](https://antfu.me/posts/dev-ssr-on-nuxt) and later also used as the base for [Vitest](https://vitest.dev). So the general idea of vite-node has been battle-tested for quite some time now. This is a new iteration of the API by [Vladimir Sheremet](https://github.com/sheremet-va), who had already re-implemented vite-node in Vitest and took the learnings to make the API even more powerful and flexible when adding it to Vite Core. The PR was one year in the makings, you can see the evolution and discussions with ecosystem maintainers [here](https://github.com/vitejs/vite/issues/12165).

Read more in the [Vite Runtime API guide](/guide/api-vite-runtime) and [give us feedback](https://github.com/vitejs/vite/discussions/15774).

## Features

### Improved support for `.css?url`
Expand Down
8 changes: 8 additions & 0 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,18 @@ When set to `true`, the build will also generate an SSR manifest for determining

Produce SSR-oriented build. The value can be a string to directly specify the SSR entry, or `true`, which requires specifying the SSR entry via `rollupOptions.input`.

## build.emitAssets

- **Type:** `boolean`
- **Default:** `false`

During non-client builds, static assets aren't emitted as it is assumed they would be emitted as part of the client build. This option allows frameworks to force emitting them in other environments build. It is responsibility of the framework to merge the assets with a post build step.

## build.ssrEmitAssets

- **Type:** `boolean`
- **Default:** `false`
- **Deprecated:** use `build.emitAssets`

During the SSR build, static assets aren't emitted as it is assumed they would be emitted as part of the client build. This option allows frameworks to force emitting them in both the client and SSR build. It is responsibility of the framework to merge the assets with a post build step.

Expand Down
1 change: 1 addition & 0 deletions docs/guide/api-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ interface ViteDevServer {
/**
* Programmatically resolve, load and transform a URL and get the result
* without going through the http request pipeline.
* @deprecated use environment.transformRequest
*/
transformRequest(
url: string,
Expand Down
924 changes: 924 additions & 0 deletions docs/guide/api-vite-environment.md

Large diffs are not rendered by default.

236 changes: 0 additions & 236 deletions docs/guide/api-vite-runtime.md

This file was deleted.