@@ -289,13 +289,18 @@ impl DebugBuildPathsRouteKeys {
289289) ]
290290#[ serde( rename_all = "camelCase" ) ]
291291pub struct ProjectOptions {
292- /// An absolute root path (Unix or Windows path) from which all files must be nested under.
293- /// Trying to access a file outside this root will fail, so think of this as a chroot.
294- /// E.g. `/home/user/projects/my-repo`.
292+ /// An [canonicalized][std::fs::canonicalize] root path (Unix or Windows path) from which all
293+ /// files must be nested under. Trying to access a file outside this root will fail, so think
294+ /// of this as a weak chroot. E.g. `/home/user/projects/my-repo`.
295+ ///
296+ /// This serves two purposes:
297+ /// - It gives us a root to configure the file system watcher with.
298+ /// - It ensures the cache is portable when the root path is moved, since every other path is
299+ /// relative to it.
295300 pub root_path : RcStr ,
296301
297- /// A path which contains the app/pages directories, relative to [`Project::project_path`],
298- /// always Unix path. E.g. `apps/my-app`
302+ /// A path which contains the app/pages directories, relative to [`Project::project_path`].
303+ /// Always a Unix-style (`/`-separated) path. E.g. `apps/my-app`.
299304 pub project_path : RcStr ,
300305
301306 /// The contents of next.config.js, serialized to JSON.
@@ -304,8 +309,7 @@ pub struct ProjectOptions {
304309 /// A map of environment variables to use when compiling code.
305310 pub env : Vec < ( RcStr , RcStr ) > ,
306311
307- /// A map of environment variables which should get injected at compile
308- /// time.
312+ /// A map of environment variables which should get injected at compile time.
309313 pub define_env : DefineEnv ,
310314
311315 /// Filesystem watcher options.
@@ -326,9 +330,8 @@ pub struct ProjectOptions {
326330 /// The browserslist query to use for targeting browsers.
327331 pub browserslist_query : RcStr ,
328332
329- /// When the code is minified, this opts out of the default mangling of
330- /// local names for variables, functions etc., which can be useful for
331- /// debugging/profiling purposes.
333+ /// When the code is minified, this opts out of the default mangling of local names for
334+ /// variables, functions etc., which can be useful for debugging/profiling purposes.
332335 pub no_mangling : bool ,
333336
334337 /// Whether to write the route hashes manifest.
@@ -337,8 +340,8 @@ pub struct ProjectOptions {
337340 /// The version of Node.js that is available/currently running.
338341 pub current_node_js_version : RcStr ,
339342
340- /// Debug build paths for selective builds.
341- /// When set, only routes matching these paths will be included in the build.
343+ /// Debug build paths for selective builds. When set, only routes matching these paths will be
344+ /// included in the build.
342345 pub debug_build_paths : Option < DebugBuildPaths > ,
343346
344347 /// App-router page routes that should be built after non-deferred routes.
@@ -350,57 +353,42 @@ pub struct ProjectOptions {
350353 /// The version of Next.js that is running.
351354 pub next_version : RcStr ,
352355
353- /// Whether server-side HMR is enabled (disabled with --no-server-fast-refresh).
356+ /// Whether server-side HMR is enabled (disabled with ` --no-server-fast-refresh` ).
354357 pub server_hmr : bool ,
355358}
356359
360+ /// The subset of [`ProjectOptions`] that may change without restarting the process. Used by
361+ /// [`ProjectContainer::update`].
362+ ///
363+ /// Refer to [`ProjectOptions`] for documentation on this struct's fields.
357364#[ derive( Default ) ]
358365pub struct PartialProjectOptions {
359- /// A root path from which all files must be nested under. Trying to access
360- /// a file outside this root will fail. Think of this as a chroot.
361366 pub root_path : Option < RcStr > ,
362367
363- /// A path inside the root_path which contains the app/pages directories.
364368 pub project_path : Option < RcStr > ,
365369
366- /// The contents of next.config.js, serialized to JSON.
367370 pub next_config : Option < RcStr > ,
368371
369- /// A map of environment variables to use when compiling code.
370372 pub env : Option < Vec < ( RcStr , RcStr ) > > ,
371373
372- /// A map of environment variables which should get injected at compile
373- /// time.
374374 pub define_env : Option < DefineEnv > ,
375375
376- /// Filesystem watcher options.
377376 pub watch : Option < WatchOptions > ,
378377
379- /// The mode in which Next.js is running.
380378 pub dev : Option < bool > ,
381379
382- /// The server actions encryption key.
383380 pub encryption_key : Option < RcStr > ,
384381
385- /// The build id.
386382 pub build_id : Option < RcStr > ,
387383
388- /// Options for draft mode.
389384 pub preview_props : Option < DraftModeOptions > ,
390385
391- /// The browserslist query to use for targeting browsers.
392386 pub browserslist_query : Option < RcStr > ,
393387
394- /// When the code is minified, this opts out of the default mangling of
395- /// local names for variables, functions etc., which can be useful for
396- /// debugging/profiling purposes.
397388 pub no_mangling : Option < bool > ,
398389
399- /// Whether to write the route hashes manifest.
400390 pub write_routes_hashes_manifest : Option < bool > ,
401391
402- /// Debug build paths for selective builds.
403- /// When set, only routes matching these paths will be included in the build.
404392 pub debug_build_paths : Option < DebugBuildPaths > ,
405393}
406394
0 commit comments