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: environment api #16129

Merged
merged 118 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
83068fe
feat: separate module graphs per environment
patak-dev Mar 10, 2024
5f5e0ec
feat: abstract moduleGraph into ModuleExecutionEnvironment
patak-dev Mar 10, 2024
281cf97
fix: call updateModules for each environmnet
patak-dev Mar 11, 2024
4808b27
chore: rename server environment to node environment
patak-dev Mar 11, 2024
95ae29b
refactor: move safeModulesPath set to server
patak-dev Mar 11, 2024
d8ff12a
chore: rename module and error back to ssrModule and ssrError
patak-dev Mar 11, 2024
e966ba0
feat: add `hot` property to environments
sheremet-va Mar 11, 2024
1fe63b1
chore: run prettier on environment file
sheremet-va Mar 11, 2024
5e60d8a
refactor: hooks get an environment object instead of a string
patak-dev Mar 11, 2024
30be775
fix: HotContext only gets ModuleExecutionEnvironment
patak-dev Mar 11, 2024
e30b858
refactor: options and environment are required when calling container…
patak-dev Mar 11, 2024
03d3889
refactor: rework resolveId in ModuleExecutionEnvironment constructor
patak-dev Mar 11, 2024
fcebb7d
feat: environment.transformRequest
patak-dev Mar 12, 2024
f927702
chore: lint
patak-dev Mar 12, 2024
88fea3b
feat: configureDevEnvironments + configureBuildEnvironments
patak-dev Mar 12, 2024
60f7f2b
feat: vite runtime renamed to module runner (#16137)
sheremet-va Mar 13, 2024
81abf6e
wip: environment config overrides
patak-dev Mar 13, 2024
a99475e
chore: merge main
patak-dev Mar 13, 2024
92eccf9
chore: lint
patak-dev Mar 13, 2024
f4789a3
feat: builder config, runBuildTasks option
patak-dev Mar 14, 2024
7f94c03
feat: server.runHmrTasks
patak-dev Mar 14, 2024
9a600fe
chore: update
patak-dev Mar 14, 2024
b9ad620
chore: merge main
patak-dev Mar 14, 2024
5c6b6ff
fix: type error
patak-dev Mar 14, 2024
3e6216c
refactor: hooks to config for creating environments
patak-dev Mar 16, 2024
6e71b24
refactor: ModuleExecutionEnvironment -> DevEnvironment
patak-dev Mar 16, 2024
29f1b7b
refactor: environment id,type -> name + fixes
patak-dev Mar 16, 2024
cef1091
feat: inject environment in build hooks
patak-dev Mar 16, 2024
e03bac8
refactor: node -> ssr for default environment
patak-dev Mar 17, 2024
f1d660c
refactor: environments as array instead of map (#16193)
patak-dev Mar 18, 2024
ccf3de4
refactor: clientEnvironment instead of browserEnvironment (#16194)
patak-dev Mar 20, 2024
27e6488
chore: merge main
patak-dev Mar 22, 2024
a7a06fe
refactor: environments array to plain object
patak-dev Mar 22, 2024
8000e8e
refactor: isolate back compat module graph in its own module
patak-dev Mar 22, 2024
fee54ea
refactor: configEnvironment hook + enviroment config resolving
patak-dev Mar 22, 2024
d9ed857
test: fix after merge
patak-dev Mar 22, 2024
dbcc375
feat: support transport options to communicate between the environmen…
sheremet-va Mar 22, 2024
3806fe6
fix: optimizeDeps backward compatibility layer
patak-dev Mar 22, 2024
85ada0d
fix: partial backward compat for config.ssr
patak-dev Mar 22, 2024
c4f4dfb
fix: use "register" event for remote environment transport
sheremet-va Mar 25, 2024
a5ef42e
test: add test for worker transport
sheremet-va Mar 25, 2024
f29e95a
refactor: remove default nodeModuleRunner because it's not used anywhere
sheremet-va Mar 25, 2024
c9abcfc
refactor: rename createSsrEnvironment to createNodeEnvironment
sheremet-va Mar 25, 2024
6040ab3
chore: fix lint
sheremet-va Mar 25, 2024
b4e46fe
chore: fix lint
sheremet-va Mar 25, 2024
fbe6361
feat: environment in hooks, context vs param (#16261)
patak-dev Mar 26, 2024
36463d2
chore: merge main
patak-dev Mar 27, 2024
52edfc9
refactor: pass down name to the environment factory
sheremet-va Mar 27, 2024
9005841
refactor: allow custom connections in node module runner
sheremet-va Mar 27, 2024
8785f4f
chore: lint
sheremet-va Mar 27, 2024
96e825a
feat: --environment in CLI
patak-dev Mar 28, 2024
5477972
refactor: use ssr environment module graph in ssrFixStacktrace
sheremet-va Mar 28, 2024
a160a1b
fix: add auto complete to server.environments
sheremet-va Mar 28, 2024
31e1d3a
fix: fine-grained hmr
sheremet-va Mar 28, 2024
72fe84e
refactor: rename ssrInvalidates to invalidates
sheremet-va Mar 28, 2024
c7e4da2
refactor: base environment.config + environment.options
patak-dev Mar 28, 2024
2ddf28e
chore: update environment.server.config
patak-dev Mar 28, 2024
681ccd4
fix: injectEnvironmentToHooks
patak-dev Mar 29, 2024
a1d385c
fix: injectEnvironmentInContext
patak-dev Mar 29, 2024
c1fc111
refactor: buildEnvironments + hmrEnvironments
patak-dev Mar 29, 2024
3d37ac1
feat(hmr): call `hotUpdate` hook with file create/delete (#16249)
sapphi-red Mar 29, 2024
6f9467e
chore: merge main
patak-dev Mar 29, 2024
a5c7e4f
test(environment): add environment playground (#16299)
hi-ogawa Mar 29, 2024
ca0ecf9
test: skip hmt ssr test for now
sheremet-va Mar 29, 2024
a0b7edb
refactor: rename "hmrEnvironments" to "hotUpdateEnvironments"
sheremet-va Mar 29, 2024
4986641
test: fix windows test
sheremet-va Mar 29, 2024
41dcca1
chore: merge main
patak-dev Mar 29, 2024
fb9365c
fix: resolve.externalConditions
patak-dev Mar 30, 2024
beb40ef
fix: missing externalConditions back compat
patak-dev Mar 31, 2024
ef8c9b9
feat: build.ssrEmitAssets -> build.emitAssets
patak-dev Mar 31, 2024
a183a0f
refactor: remove environment name from the hmr context
sheremet-va Apr 2, 2024
9cfa916
refactor: move transport to properties
sheremet-va Apr 2, 2024
dd6332e
feat: environment aware createResolver and resolvePlugin
patak-dev Apr 3, 2024
f1dcd2c
feat: environment aware createIdResolver
patak-dev Apr 3, 2024
0bec1b9
feat: environment id resolver for css plugin
patak-dev Apr 3, 2024
a7e52aa
feat: environment aware depsOptimizer
patak-dev Apr 4, 2024
5bd8e95
refactor: ssrConfig.optimizeDeps.include/exclude
patak-dev Apr 4, 2024
1a7d290
feat: ssr.target -> environment.webCompatible
patak-dev Apr 5, 2024
2a0b524
feat: ssr.external/noExternal -> resolve.external/noExternal
patak-dev Apr 5, 2024
f96f682
release: v6.0.0-alpha.0
patak-dev Apr 5, 2024
3a27870
docs: fix capitalization typos (#16309)
jay-es Mar 29, 2024
67a74f8
fix: csp nonce injection when no closing tag (#16281) (#16282)
gregtwallace Mar 31, 2024
b39a7ed
ci: run lint in node 20 (#16338)
sapphi-red Apr 3, 2024
833dabf
chore: merge
sapphi-red Apr 3, 2024
a88d572
chore(deps): update tj-actions/changed-files action to v44 (#16326)
renovate[bot] Apr 3, 2024
c7efec4
chore(deps): update all non-major dependencies (#16325)
renovate[bot] Apr 3, 2024
9699ba3
fix: fix sourcemap when using object as `define` value (#15805)
hi-ogawa Apr 3, 2024
6c5536b
fix: do not access document in `/@vite/client` when not defined (#16318)
keyding Apr 3, 2024
dfce45b
chore: `pnpm audit --fix` (#16346)
sapphi-red Apr 3, 2024
bcac048
chore: merge
sapphi-red Apr 3, 2024
8d08db4
ci: run publish in node 20 (#16348)
sapphi-red Apr 3, 2024
a9bf430
perf: reduce size of injected __vite__mapDeps code (#16184)
panstromek Apr 5, 2024
f61d8b1
perf(css): only replace empty chunk if imported (#16349)
bluwy Apr 5, 2024
5f3c44f
chore: merge main
patak-dev Apr 5, 2024
8621c3f
fix(environment): use `environments.client.build.outDir` for preview …
hi-ogawa Apr 6, 2024
27371dc
chore: remove ssrConfig
patak-dev Apr 6, 2024
d91714b
refactor: isFileServingAllowed load fallback for SSR
patak-dev Apr 6, 2024
ea1c7eb
refactor: environment.dev.recoverable
patak-dev Apr 6, 2024
0ea8be9
chore: remove ssr.target use
patak-dev Apr 6, 2024
3ba9214
feat: dedupe/preserveSymlinks
patak-dev Apr 8, 2024
70731ce
refactor: lib options
patak-dev Apr 8, 2024
d15a157
feat: async createEnvironment
patak-dev Apr 8, 2024
f10561b
chore: merge main
patak-dev Apr 8, 2024
bdf13bb
fix: package types
patak-dev Apr 8, 2024
7254175
release: v6.0.0-alpha.1
patak-dev Apr 8, 2024
1f644d0
feat: rework more ssr.target webworker branches
patak-dev Apr 9, 2024
9f9a716
feat: environment aware define
patak-dev Apr 9, 2024
4cd3183
chore: merge main
patak-dev Apr 9, 2024
46c8910
chore: update
patak-dev Apr 9, 2024
9c5321b
release: v6.0.0-alpha.2
patak-dev Apr 9, 2024
84299f3
feat: environment.dev.warmup
patak-dev Apr 10, 2024
59b995e
refactor: proxy environment logger, remove hardcoded `[vite]` from hm…
sheremet-va Apr 12, 2024
52a71e6
refactor: environments have colors in the logger, update logger.info …
sheremet-va Apr 12, 2024
ae1798f
chore: rename runner to evaluator in serverModuleRunner
sheremet-va Apr 16, 2024
5b57f63
feat: deprecate ssrLoadModule (#16431)
sheremet-va Apr 16, 2024
b4fdfaf
feat: keep url queries in ssr mode (#16400)
sheremet-va Apr 16, 2024
319b8e0
feat: decouple DevEnvironment and server (#16460)
patak-dev Apr 19, 2024
635e6d5
chore: merge main
patak-dev Apr 19, 2024
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
Prev Previous commit
Next Next commit
chore: update
  • Loading branch information
patak-dev committed Mar 14, 2024
commit 9a600fec8ae86f3f0445e4c6d12f0f0effae10f5
25 changes: 22 additions & 3 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1298,12 +1298,31 @@ export interface BuilderOptions {
) => Promise<void>
}

export interface BuilderInlineConfig extends Omit<InlineConfig, 'plugins'> {
plugins?: () => Plugin[]
}

export async function createViteBuilder(
builderOptions: BuilderOptions = {},
defaultInlineConfig: InlineConfig = {},
defaultInlineConfig: BuilderInlineConfig = {},
): Promise<ViteBuilder> {
// Plugins passed to the Builder inline config needs to be created
// from a factory to ensure each build has their own instances
const getDefaultInlineConfig = (): InlineConfig => {
const { plugins } = defaultInlineConfig
return plugins
? {
...defaultInlineConfig,
plugins: plugins(),
}
: (defaultInlineConfig as InlineConfig)
}

// We need to resolve a default config to get the plugins and be able
// to run the configureBuildEnvironments hooks. Maybe we should expose
// this hook as a builder option instead to avoid this.
const defaultConfig = await resolveConfig(
defaultInlineConfig,
getDefaultInlineConfig(),
'build',
'production',
'production',
Expand Down Expand Up @@ -1349,7 +1368,7 @@ export async function createViteBuilder(
// and to process a single bundle at a time (contrary to dev mode where
// plugins are built to handle multiple environments concurrently).

let userConfig = defaultInlineConfig
let userConfig = getDefaultInlineConfig()
const inlineConfigEnvironmentOverrides =
defaultInlineConfig.environment?.[environment.id]
if (inlineConfigEnvironmentOverrides) {
Expand Down
7 changes: 5 additions & 2 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ export interface SharedEnvironmentConfig {
resolve?: ResolveOptions & { alias?: AliasOptions }
/**
* Dep optimization options
* These options are only used during dev. It should better be in the
* dev options but there isn't a strong enough reason to move it there
* at this point.
*/
optimizeDeps?: DepOptimizationOptions
}
Expand Down Expand Up @@ -337,8 +340,8 @@ export interface UserConfig extends EnvironmentConfig {
appType?: AppType
/**
* SSR specific options
* Some of the options previously under `ssr` (like resolve.conditions) are deprecated
* and moved to environment: { ssr: { ... } }
* We could make SSROptions be a EnvironmentConfig if we can abstract
* external/noExternal for environments in general.
*/
ssr?: SSROptions
/**
Expand Down
Loading