ui5-plugin-loader
v0.2.0
Published
Auto-mounts UI5 tooling extensions based on manifest JSON files
Maintainers
Readme
ui5‑plugin‑loader
A UI5 Tooling v4 extension that auto‑mounts other extensions based on manifest JSON files
Overview
ui5‑plugin‑loader v0.2.x provides a single‑line integration that automatically discovers and loads UI5 tooling extensions based on manifest JSON files. Simply add one entry to your ui5.yaml and all compatible dependencies will be loaded automatically in the correct order.
Features
- ✅ Single-line setup - Only requires one
ui5.yamlentry - ✅ Auto-discovery - Scans all dependencies for manifest files
- ✅ Smart ordering - Fixed pattern ordering: stringreplace → transpile → modules → livereload → rest
- ✅ Server & Build support - Works with both
ui5 serveandui5 build - ✅ Fallback manifests - Includes manifests for popular extensions
- ✅ Disable/Override support - Disable extensions or override their configuration
- ✅ Graceful failure - Invalid manifests won't crash your dev server
- ✅ Comprehensive logging - Uses
@ui5/loggerwith configurable levels
Requirements
- UI5 Tooling v4.0 or higher (for dynamic middleware registration)
- Node.js v18.0.0 or higher
- npm v8 or higher
Installation
npm install --save-dev ui5-plugin-loaderQuick Start
1. Add to your ui5.yaml
specVersion: '4.0'
metadata:
name: my-ui5-app
type: application
server:
customMiddleware:
- name: ui5-plugin-loader
afterMiddleware: compression
builder:
customTasks:
- name: ui5-plugin-loader-task
afterTask: replaceVersion2. Install extensions
Install any supported UI5 tooling extension:
npm install --save-dev ui5-tooling-modules
npm install --save-dev ui5-middleware-livereload
npm install --save-dev ui5-tooling-transpile
npm install --save-dev ui5-tooling-stringreplace3. Run your project
ui5 serve # or ui5 buildThat's it! The plugin loader will automatically:
- Scan all your dependencies and devDependencies
- Look for
ui5-plugin-loader.jsonmanifests in each package - Fall back to built-in manifests for popular extensions
- Auto-register all found middlewares and tasks with smart ordering
Currently Supported Extensions
The plugin loader includes built-in support for these popular UI5 tooling extensions:
Middlewares
ui5-tooling-stringreplace- String replacement for placeholdersui5-tooling-transpile- TypeScript and modern JavaScript transpilationui5-tooling-modules- ES modules and Node.js modules transformationui5-middleware-livereload- Live reload functionality for development
Tasks
ui5-tooling-stringreplace- Build-time string replacementui5-tooling-transpile- Build-time TypeScript transpilationui5-tooling-modules- Build-time modules transformation
Adding More Extensions
To add support for additional extensions, create a manifest file in the manifests/ directory or contribute to this project by submitting a PR with new manifest files.
How It Works
The plugin loader follows this discovery and processing pipeline:
- Load Configuration: Validate and normalize the configuration options
- Discover Manifests: Scan dependencies for manifest files
- Apply Disable: Remove extensions from the disable list
- Fill Defaults: Add default
afterMiddleware: compressionandafterTask: replaceVersion - Apply Overrides: Merge override configurations
- Validate References: Check that all after/before targets exist
- Deduplicate: Remove duplicates (first occurrence wins)
- Smart Sort: Apply fixed pattern ordering: stringreplace → transpile → modules → livereload → rest
Configuration Options
You can customize the plugin loader behavior in your ui5.yaml:
server:
customMiddleware:
- name: ui5-plugin-loader
afterMiddleware: compression
configuration:
debug: false # Enable debug logging
disable: # Disable specific extensions
- ui5-middleware-livereload
- ui5-tooling-stringreplace-middleware
override: # Override extension configurations
ui5-tooling-transpile-middleware:
afterMiddleware: ui5-tooling-stringreplace-middleware
configuration:
debug: true
builder:
customTasks:
- name: ui5-plugin-loader-task
afterTask: replaceVersion
configuration:
debug: false # Enable debug logging
disable: # Disable specific extensions
- ui5-tooling-stringreplace-task
override: # Override extension configurations
ui5-tooling-modules-task:
afterTask: ui5-tooling-transpile-task
configuration:
debug: trueConfiguration Properties
debug(boolean, default: false): Enable debug logging to@ui5/loggerverbosedisable(string[], default: []): Array of extension names to disableoverride(object, default: {}): Override configurations for specific extensions- Each key is an extension name
- Each value can contain:
afterMiddleware/beforeMiddleware- Change middleware orderafterTask/beforeTask- Change task ordermountPath- Override middleware mount pathconfiguration- Merge with extension's default configuration
Example Configurations
Basic Development Setup
server:
customMiddleware:
- name: ui5-plugin-loader
afterMiddleware: compressionTypeScript Development with Customization
server:
customMiddleware:
- name: ui5-plugin-loader
afterMiddleware: compression
configuration:
debug: true
disable:
- ui5-middleware-livereload # Disable livereload
override:
ui5-tooling-stringreplace-middleware:
configuration:
files: ["**/*.ts"] # Only process TypeScript filesProduction Build Configuration
builder:
customTasks:
- name: ui5-plugin-loader-task
afterTask: replaceVersion
configuration:
disable:
- ui5-tooling-stringreplace-task # Skip string replacement in production
override:
ui5-tooling-modules-task:
configuration:
minify: true # Enable minificationSmart Ordering
The plugin loader uses a fixed pattern ordering system:
- String replacement (priority 10) -
ui5-tooling-stringreplace-* - Transpilation (priority 20) -
ui5-tooling-transpile-* - Modules (priority 30) -
ui5-tooling-modules-* - Live reload (priority 40) -
ui5-middleware-livereload - Rest (priority 50) - All other extensions
This ensures that transformations happen in the correct order without manual configuration.
Extension Development Guide
Making Your Extension Compatible
To make your UI5 tooling extension work with the plugin loader:
- Create a manifest file
ui5-plugin-loader.jsonin your package root:
{
"$schema": "https://sap.github.io/ui5-plugin-loader/schema/ui5-plugin-loader.schema.json",
"middleware": [
{
"name": "my-custom-middleware",
"configuration": {
"debug": false
}
}
],
"tasks": [
{
"name": "my-custom-task",
"configuration": {
"debug": false
}
}
]
}Follow naming conventions:
- Middleware:
<package-name>-middlewareor<package-name> - Tasks:
<package-name>-task
- Middleware:
Test with the plugin loader:
- Install your extension alongside
ui5-plugin-loader - Verify it gets auto-discovered and registered
- Install your extension alongside
Troubleshooting
Enable Debug Logging
server:
customMiddleware:
- name: ui5-plugin-loader
configuration:
debug: trueCommon Issues
- Extension not found: Ensure the package is in your
dependenciesordevDependencies - Wrong order: Use the
overrideconfiguration to adjust ordering - Duplicate registration: Check for manual registrations in your
ui5.yaml
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
v0.2.x
- ✅ Removed preset functionality (breaking change)
- ✅ Added
debug,disable, andoverrideconfiguration options - ✅ Implemented fixed pattern smart ordering
- ✅ Improved pipeline processing with validation
- ✅ Enhanced error handling and logging
v0.1.x
- ✅ Initial release with basic auto-discovery
- ✅ Support for popular UI5 tooling extensions
- ✅ Preset functionality (deprecated in v0.2.x)
