processors

@ui5/builder. processors

Classes

ThemeBuilder

Methods

(async, static) apiIndexGenerator(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Compiles API index resources from all api.json resources available in the given test resources directory as created by the sdkTransformer processor. The resulting index resources (e.g. api-index.json, api-index-deprecated.json, api-index-experimental.json and api-index-since.json) are mainly to be used in the SDK.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
versionInfoPath string Path to sap-ui-version.json resource
testResourcesRootPath string Path to /test-resources root directory in the given fs
targetApiIndexPath string Path to create the generated API index JSON resource for
targetApiIndexDeprecatedPath string Path to create the generated API index "deprecated" JSON resource for
targetApiIndexExperimentalPath string Path to create the generated API index "experimental" JSON resource for
targetApiIndexSincePath string Path to create the generated API index "since" JSON resource for
fs fs | module:@ui5/fs.fsInterface Node fs or custom fs interface to use
Returns:
Promise resolving with created resources api-index.json, api-index-deprecated.json, api-index-experimental.json and api-index-since.json (names depend on the supplied paths)
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) debugFileCreator(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Creates *-dbg.js files for all supplied resources.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
fs fs | module:@ui5/fs.fsInterface Node fs or custom fs interface
Returns:
Promise resolving with debug resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) flexChangesBundler(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Bundles all supplied changes.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Attributes Default Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
options object Options
Properties
Name Type Description
pathPrefix string Prefix for bundle path
hasFlexBundleVersion string true if minUI5Version >= 1.73 than create flexibility-bundle.json
existingFlexBundle object <optional>
{} Object with existing flexibility-bundle.json to merge with new changes
Returns:
Promise resolving with flex changes bundle resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(async, static) jsdocGenerator(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
JSDoc generator
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
sourcePath string Path of the source files to be processed
targetPath string Path to write any output files
tmpPath string Path to write temporary and debug files
options object Options
Properties
Name Type Attributes Default Description
projectName string Project name
namespace string Namespace to build (e.g. some/project/name)
version string Project version
variants Array <optional>
["apijson"] JSDoc variants to be built
Returns:
Promise resolving with newly created resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) libraryLessGenerator(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Creates a "library.less" file for the SAP Theme Designer based on a "library.source.less" file.
  • Bundles all *.less file of the theme by replacing the import with the corresponding file content
  • Imports to "base.less" are adopted so that they point to the "BaseLib" that is available within the Theme Designer infrastructure
  • Imports to "global.less" are kept as they should not be bundled
  • Imports to "library.source.less" are adopted to "library.less"
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of library.source.less resources
fs fs | module:@ui5/fs.fsInterface Node fs or custom fs interface
Returns:
Promise resolving with library.less resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) manifestBundler(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Creates a manifest bundle from the provided resources.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
options object Options
Properties
Name Type Description
namespace string Namespace of the project
bundleName string Name of the bundled zip file
propertiesExtension string Extension name of the properties files, e.g. ".properties"
descriptor string Descriptor name
Returns:
Promise resolving with manifest bundle resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) moduleBundler(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Legacy preload bundler.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> Resources
options object Options
Properties
Name Type Description
bundleDefinition ModuleBundleDefinition Module bundle definition
bundleOptions ModuleBundleOptions Module bundle options
Returns:
Promise resolving with module bundle resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(async, static) nonAsciiEscaper(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Escapes non ASCII characters with unicode escape sequences.
Example
const encoding = nonAsciiEscaper.getEncodingFromAlias("ISO-8859-1");
nonAsciiEscaper({resources, options: {encoding}});
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Attributes Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
options object <optional>
Options
Properties
Name Type Attributes Default Description
encoding string <optional>
"utf8" resource file encoding (Node.js character encodings). Use #getEncodingFromAlias to get the encoding string
Returns:
Promise resolving with the processed resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) nonAsciiEscaper․getEncodingFromAlias(encoding) → {string}

Source:
Provides a mapping from user-friendly encoding name (alias) such as "UTF-8" and "ISO-8859-1" to node specific encoding name such as "utf8" or "latin1". Simplifies usage of nonAsciiEscaper encoding option such that it can be used standalone without the respective task (e.g. in Splitter, Bundler and related projects).
Parameters:
Name Type Description
encoding string encoding labels: "UTF-8" and "ISO-8859-1"
Returns:
node.js character encoding string, e.g. utf8 and latin1
Type
string

(static) resourceCopier(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Copy files to a different path.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
options object Options
Properties
Name Type Description
pattern string Search pattern for path
replacement string Replacement string for path
Returns:
Promise resolving with the cloned resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(async, static) sdkTransformer(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Transform api.json as created by jsdocGenerator for usage in a UI5 SDK
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
apiJsonPath string Path to the projects api.json file as created by jsdocGenerator
dotLibraryPath string Path to the projects .library file
dependencyApiJsonPaths Array.<string> List of paths to the api.json files of all dependencies of the project as created by jsdocGenerator
targetApiJsonPath string Path to create the new, transformed api.json resource for
fs fs | module:@ui5/fs.fsInterface Node fs or custom fs interface to use
Returns:
Promise resolving with created resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) stringReplacer(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Replaces placeholders with corresponding values.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
options object Options
Properties
Name Type Description
pattern string Pattern of placeholders
replacement string Replacement for placeholders
Returns:
Promise resolving with modified resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) themeBuilder(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Builds a library theme.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Attributes Description
resources Array.<module:@ui5/fs.Resource> List of library.source.less resources to be processed
fs fs | module:@ui5/fs.fsInterface Node fs or custom fs interface
options ThemeBuilderOptions <optional>
Options
Returns:
Promise resolving with theme resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) uglifier(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Minifies the supplied resources.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
resources Array.<module:@ui5/fs.Resource> List of resources to be processed
Returns:
Promise resolving with uglified resources
Type
Promise.<Array.<module:@ui5/fs.Resource>>

(static) versionInfoGenerator(parameters) → {Promise.<Array.<module:@ui5/fs.Resource>>}

Source:
Creates sap-ui-version.json.
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
options object Options
Properties
Name Type Description
rootProjectName string Name of the root project
rootProjectVersion string Version of the root project
libraryInfos Array.<LibraryInfo> Array of objects representing libraries, e.g.
  {
     name: "lib.x",
     version: "1.0.0",
     libraryManifest: module:@ui5/fs.Resource,
     embeddedManifests: module:@ui5/fs.Resource[]
  }
Returns:
Promise resolving with an array containing the versionInfo resource
Type
Promise.<Array.<module:@ui5/fs.Resource>>