Newer Version Available

This content describes an older version of this product. View Latest

AuraDefinitionBundle

Represents a Lightning definition bundle. A bundle contains a Lightning definition and all its related resources. The definition can be a component, application, event, interface, or a tokens collection.

File Suffix and Directory Location

A Lightning bundle is a folder that contains definition files. Unlike other metadata components, an AuraDefinitionBundle component isn’t represented by a single component file but instead by a collection of component definition files. Each definition file represents a resource in a bundle, such as markup, applications, code files (including controllers and helpers), events, documentation, and interfaces. For example, this directory structure shows the hierarchy of the folders and files for two bundles: bundle1 and bundle2.

1aura
2    bundle1
3        bundle1.cmp
4        bundle1Controller.js
5    bundle2
6        bundle2.app
7        bundle2.cmp
8        bundle2Controller.js
9        bundle2.auradoc

Lightning bundles must be under a top-level folder that’s named aura. Each bundle must have its own subfolder under the aura folder. The name of each definition file must start with the bundle name.

A bundle doesn’t have a suffix. Definition files can have one of these suffixes:

Suffix Component Type
.app Application
.cmp Component
.design Design
.evt Event
.intf Interface
.js Controller, Helper, or Renderer
.svg SVG image
.css Style
.auradoc Documentation
.tokens Tokens collection

Each bundle can have only one file each with a suffix of .app, .cmp, .design, .evt, .intf, or .tokens.

Version

AuraDefinitionBundle components are available in API version 32.0 and later.

Design and SVG components are available in API version 33.0 and later.

Special Access Rules

Definitions can be created only in organizations with defined namespaces.

Fields

Field Name Field Type Description
apiVersion double The API version for this definition bundle. When you create an Aura bundle, you can specify the API version to save it with. Available in API version 35.0 and later.
controllerContent base64Binary The content of a JavaScript client-side controller.
description string The specification of the Aura bundle. Available in API version 35.0 and later.
designContent base64Binary The content of a design definition. Only valid inside a component bundle.
documentationContent base64Binary The content of a documentation definition.
helperContent base64Binary The content of a JavaScript helper.
markup base64Binary The content of the markup for a definition.
modelContent base64Binary Deprecated. Do not use.
packageVersions PackageVersion[] The list of installed managed package versions that this Aura definition bundle references. Available in API version 35.0 and later.
rendererContent base64Binary The content of a JavaScript client-side renderer.
styleContent base64Binary The CSS for the definition.
SVGContent base64Binary The SVG image for the definition.
testsuiteContent base64Binary Reserved for future use.
type AuraBundleType (enumeration of type string) The definition type. Valid values are:
  • Application
  • Component
  • Event
  • Interface
  • Tokens

Declarative Metadata Sample Definition

This example shows the directory structure of an AuraDefinitionBundle component.

1aura
2    sampleCmp
3        sampleCmp.cmp
4        sampleCmpController.js

The following samples show the contents of the metadata definition files that correspond to the sample aura directory.

Content of sampleCmp.cmp:

1<aura:component>
2    <aura:attribute name="val1" type="String" default="Value"/>
3    <aura:attribute name="val2" type="String" />
4    <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
5	<ui:outputText value='Hello world!'/>
6	<ui:outputText value='{!v.val1}'/>
7	<ui:outputText value='{!v.val2}'/>
8</aura:component>

Content of sampleCmpController.js:

1({
2	myAction : function(component) {
3		component.set('v.val1','Value1');
4		component.set('v.val2','Value2');
5    }
6})

This package.xml references the definitions of all Lightning components that are present in the sampleCmp bundle.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>sampleCmp</members>
5        <name>AuraDefinitionBundle</name>
6    </types>
7    <version>37.0</version>
8</Package>