resourceFactory

@ui5/fs. resourceFactory

Source:
Resource Factory

Methods

(static) createAdapter(parameters) → {module:@ui5/fs.adapters.FileSystem|module:@ui5/fs.adapters.Memory}

Source:
Creates a resource ReaderWriter. If a file system base path is given, file system resource ReaderWriter is returned. In any other case a virtual one.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Attributes Description
virBasePath string Virtual base path
fsBasePath string <optional>
File system base path
excludes Array.<string> <optional>
List of glob patterns to exclude
project object <optional>
Experimental, internal parameter. Do not use
Returns:
File System- or Virtual Adapter
Type
module:@ui5/fs.adapters.FileSystem | module:@ui5/fs.adapters.Memory

(static) createCollectionsForTree(tree, parametersopt) → {object}

Source:
Creates resource reader collections for a (sub-)tree. Returns an object of resource readers:
{
 source: Resource reader for source resources
 dependencies: Resource readers for dependency resources
}
Parameters:
Name Type Attributes Description
tree object A (sub-)tree
parameters object <optional>
Parameters
Properties
Name Type Attributes Description
getProjectExcludes module:@ui5/fs.resourceFactory~getProjectExcludes <optional>
Callback to retrieve the exclude globs of a project
getVirtualBasePathPrefix module:@ui5/fs.resourceFactory~getVirtualBasePathPrefix <optional>
Callback to retrieve a prefix for a given virtual base path of a project if required
virtualReaders object <optional>
Experimental, internal parameter. Do not use
Returns:
Object containing source and dependencies resource readers
Type
object

(static) createResource(parameters) → {module:@ui5/fs.Resource}

Source:
Creates a Resource. Accepts the same parameters as the Resource constructor.
Parameters:
Name Type Description
parameters object Parameters to be passed to the resource constructor
Returns:
Resource
Type
module:@ui5/fs.Resource

(static) createWorkspace(parameters) → {module:@ui5/fs.DuplexCollection}

Source:
Creates a Workspace A workspace is a DuplexCollection which reads from the project sources. It is used during the build process to write modified files into a separate writer, this is usually a Memory adapter. If a file already exists it is fetched from the memory to work on it in further build steps.
Parameters:
Name Type Description
parameters object
Properties
Name Type Attributes Default Description
reader module:@ui5/fs.AbstractReader Single reader or collection of readers
writer module:@ui5/fs.AbstractReaderWriter <optional>
A ReaderWriter instance which is only used for writing files. If not supplied, a Memory adapter will be created.
name string <optional>
"vir & fs source" Name of the collection
virBasePath string <optional>
"/" Virtual base path
Returns:
DuplexCollection which wraps the provided resource locators
Type
module:@ui5/fs.DuplexCollection

Type Definitions

getProjectExcludes(Project) → {Array.<string>}

Source:
Callback to retrieve excludes for a given project
Parameters:
Name Type Description
Project object
Returns:
List of glob patterns to exclude
Type
Array.<string>

getVirtualBasePathPrefix(parameters) → {string}

Source:
Callback to retrieve a prefix to use for a given virtual base path of a project
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
project object Project
virBasePath object virtual base path to prefix
Returns:
Prefix for the virtual base path
Type
string