@@ -298,7 +298,7 @@ pub struct Component {
298
298
/// Example: `source = "bin/cart.wasm"`
299
299
///
300
300
/// Learn more: https://spinframework.dev/writing-apps#the-component-source
301
- pub source : ComponentSource ,
301
+ pub ( crate ) source : ComponentSource ,
302
302
/// A human-readable description of the component.
303
303
///
304
304
/// Example: `description = "Shopping cart"`
@@ -397,7 +397,7 @@ pub struct Component {
397
397
///
398
398
/// Learn more: https://spinframework.dev/build
399
399
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
400
- pub build : Option < ComponentBuildConfig > ,
400
+ pub ( crate ) build : Option < ComponentBuildConfig > ,
401
401
/// Settings for custom tools or plugins. Spin ignores this field.
402
402
#[ serde( default , skip_serializing_if = "Map::is_empty" ) ]
403
403
#[ schemars( schema_with = "json_schema::map_of_toml_tables" ) ]
@@ -414,9 +414,11 @@ pub struct Component {
414
414
/// Learn more: https://spinframework.dev/writing-apps#using-component-dependencies
415
415
#[ serde( default , skip_serializing_if = "ComponentDependencies::is_empty" ) ]
416
416
pub dependencies : ComponentDependencies ,
417
- /// TODO: profile docs
417
+ /// Override values to use when building or running a named build profile.
418
+ ///
419
+ /// Example: `profile.debug.build.command = "npm run build-debug"`
418
420
#[ serde( default , skip_serializing_if = "Map::is_empty" ) ]
419
- pub profile : Map < String , ComponentProfileOverride > ,
421
+ pub ( crate ) profile : Map < String , ComponentProfileOverride > ,
420
422
}
421
423
422
424
/// Customisations for a Spin component in a non-default profile.
@@ -429,13 +431,13 @@ pub struct ComponentProfileOverride {
429
431
///
430
432
/// Learn more: https://spinframework.dev/writing-apps#the-component-source
431
433
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
432
- pub source : Option < ComponentSource > ,
434
+ source : Option < ComponentSource > ,
433
435
434
436
/// The command or commands for building the component in non-default profiles.
435
437
/// If a component has no special build instructions for a profile, the
436
438
/// default build command is used.
437
439
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
438
- pub build : Option < ComponentProfileBuildOverride > ,
440
+ build : Option < ComponentProfileBuildOverride > ,
439
441
}
440
442
441
443
/// Customisations for a Spin component build in a non-default profile.
@@ -448,7 +450,7 @@ pub struct ComponentProfileBuildOverride {
448
450
/// Example: `build.command = "cargo build"`
449
451
///
450
452
/// Learn more: https://spinframework.dev/build#setting-up-for-spin-build
451
- pub command : super :: common:: Commands ,
453
+ command : super :: common:: Commands ,
452
454
}
453
455
454
456
impl Component {
@@ -470,7 +472,7 @@ impl Component {
470
472
}
471
473
472
474
/// The build configuration for the component
473
- pub fn build_config ( & self , profile : Option < impl AsRef < str > > ) -> Option < ComponentBuildConfig > {
475
+ pub fn build ( & self , profile : Option < & str > ) -> Option < ComponentBuildConfig > {
474
476
let build_config = self . build . clone ( ) ;
475
477
let build_profile = self . profile ( profile) . and_then ( |o| o. build . as_ref ( ) ) ;
476
478
@@ -491,8 +493,8 @@ impl Component {
491
493
Some ( build_config)
492
494
}
493
495
494
- /// TODO: docs! docs! docs!
495
- pub fn source ( & self , profile : Option < impl AsRef < str > > ) -> & ComponentSource {
496
+ /// The source for the component Wasm binary (e.g. local file, registry reference, etc.).
497
+ pub fn source ( & self , profile : Option < & str > ) -> & ComponentSource {
496
498
let profile_source = self . profile ( profile) . and_then ( |o| o. source . as_ref ( ) ) ;
497
499
498
500
match profile_source {
0 commit comments