@ui5/builder
Advanced tools
Comparing version 2.8.4 to 2.9.0
@@ -5,4 +5,10 @@ # Changelog | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.8.4...HEAD). | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.9.0...HEAD). | ||
<a name="v2.9.0"></a> | ||
## [v2.9.0] - 2021-05-30 | ||
### Features | ||
- Support writing 'bundles' config as part of a bundle ([#396](https://github.com/SAP/ui5-builder/issues/396)) [`b5f372a`](https://github.com/SAP/ui5-builder/commit/b5f372a6ab9c31f3acef41a59e6cecd6681be2dd) | ||
<a name="v2.8.4"></a> | ||
@@ -566,2 +572,3 @@ ## [v2.8.4] - 2021-05-17 | ||
[v2.9.0]: https://github.com/SAP/ui5-builder/compare/v2.8.4...v2.9.0 | ||
[v2.8.4]: https://github.com/SAP/ui5-builder/compare/v2.8.3...v2.8.4 | ||
@@ -568,0 +575,0 @@ [v2.8.3]: https://github.com/SAP/ui5-builder/compare/v2.8.2...v2.8.3 |
@@ -58,2 +58,10 @@ /* eslint quotes: ["error", "double", { "allowTemplateLiterals": true }] */ | ||
beforeBundleInfo(outW) { | ||
outW.writeln("\"unsupported\"; /* 'bundleInfo' section mode not supported (requires ui5loader)"); | ||
}, | ||
afterBundleInfo(outW) { | ||
outW.writeln("*/"); | ||
}, | ||
requireSync(outW, moduleName) { | ||
@@ -81,2 +89,10 @@ outW.writeln(`sap.ui.requireSync("${ModuleName.toRequireJSName(moduleName)}");`); | ||
beforeBundleInfo(outW) { | ||
outW.writeln("sap.ui.loader.config({bundlesUI5:{"); | ||
}, | ||
afterBundleInfo(outW) { | ||
outW.writeln("}});"); | ||
}, | ||
requireSync(outW, moduleName) { | ||
@@ -146,3 +162,3 @@ outW.writeln(`sap.ui.requireSync("${ModuleName.toRequireJSName(moduleName)}");`); | ||
this.openModule(resolvedModule.name); | ||
let bundleInfos = []; | ||
// create all sections in sequence | ||
@@ -152,4 +168,16 @@ for ( const section of resolvedModule.sections ) { | ||
section.name ? " '" + section.name + "'" : "", section.mode); | ||
await this.addSection(section); | ||
if ( section.mode === SectionType.BundleInfo ) { | ||
bundleInfos.push(section); | ||
} else { | ||
if ( bundleInfos.length > 0 ) { | ||
await this.writeBundleInfos(bundleInfos); | ||
bundleInfos = []; | ||
} | ||
await this.addSection(section); | ||
} | ||
} | ||
if ( bundleInfos.length > 0 ) { | ||
await this.writeBundleInfos(bundleInfos); | ||
bundleInfos = []; | ||
} | ||
@@ -211,2 +239,4 @@ this.closeModule(resolvedModule); | ||
return this.writePreloadFunction(section); | ||
case SectionType.BundleInfo: | ||
return this.writeBundleInfos([section]); | ||
case SectionType.Require: | ||
@@ -452,2 +482,22 @@ return this.writeRequires(section); | ||
writeBundleInfos(sections) { | ||
this.outW.ensureNewLine(); | ||
if ( sections.length > 0 ) { | ||
this.targetBundleFormat.beforeBundleInfo(this.outW); | ||
sections.forEach((section, idx) => { | ||
if ( idx > 0 ) { | ||
this.outW.writeln(","); | ||
} | ||
if (!section.name) { | ||
throw new Error(`A 'bundleInfo' section is missing the mandatory 'name' property.` ); | ||
} | ||
this.outW.write(`"${section.name}":[${section.modules.map(makeStringLiteral).join(",")}]`); | ||
}); | ||
this.outW.writeln(); | ||
this.targetBundleFormat.afterBundleInfo(this.outW); | ||
} | ||
} | ||
writeRequires(section) { | ||
@@ -454,0 +504,0 @@ this.outW.ensureNewLine(); |
@@ -21,3 +21,10 @@ "use strict"; | ||
/** | ||
* For each module, a jQuery.sap.require call will be created. | ||
* Content information for another bundle is written. | ||
* Requires UI5 version 1.74.0 which adds runtime support for the 'bundles' and 'bundlesUI5' | ||
* ui5loader configuration. | ||
*/ | ||
BundleInfo: "bundleInfo", | ||
/** | ||
* For each module, a require call will be created. | ||
* Usually used as the last section in a merged module to enforce loading and | ||
@@ -24,0 +31,0 @@ * execution of some specific module or modules. |
@@ -7,4 +7,4 @@ const BundleBuilder = require("../../lbt/bundle/Builder"); | ||
/** | ||
* A ModuleBundleDefinitionSection specifies the embedding mode ('provided', 'raw', 'preload' or 'require') | ||
* and lists the resources that should be in- or excluded from the section. | ||
* A ModuleBundleDefinitionSection specifies the embedding mode (either 'provided', 'raw', 'preload', 'require' | ||
* or 'bundleInfo') and lists the resources that should be in- or excluded from the section. | ||
* <p> | ||
@@ -19,3 +19,3 @@ * <b>Module bundle section modes</b><br> | ||
* <li> | ||
* <code>raw</code>: A raw section determines the set of modules that should be embedded, sorts them according | ||
* <code>raw</code>: A 'raw' section determines the set of modules that should be embedded, sorts them according | ||
* to their dependencies and writes them out 1:1 without any transformation or wrapping (raw). Only JavaScript | ||
@@ -25,7 +25,7 @@ * sources can be embedded in a raw section. | ||
* <li> | ||
* <code>preload</code>: A preload section packages resources that should be stored in the preload cache in the | ||
* <code>preload</code>: A 'preload' section packages resources that should be stored in the preload cache in the | ||
* client. They can embed any textual resource type (JavaScript, XML, JSON and .properties files) that the | ||
* bundling supports. UI5 modules are wrapped into a 'sap.ui.predefine' call. Other JavaScript modules will be | ||
* embedded into a 'jQuery.sap.registerPreload' call, unless the asynchronous ui5loader is used. With the | ||
* ui5loader 'sap.ui.require.preload' is used for other modules. | ||
* embedded into a 'jQuery.sap.registerPreload' call, or in a "sap.ui.require.preload" call when | ||
* the ui5loader is available. | ||
* </li> | ||
@@ -38,2 +38,9 @@ * <li> | ||
* </li> | ||
* <li> | ||
* <code>bundleInfo</code>: A 'bundleInfo' section describes the content of another named bundle. This information | ||
* is transformed into a ui5loader-"bundlesUI5" configuration. | ||
* At runtime, if a module is known to be contained in a bundle, the loader will require that bundle before | ||
* the module itself. | ||
* This requires the ui5loader to be available at build time and UI5 version 1.74.0 or higher at runtime. | ||
* </li> | ||
* </ul> | ||
@@ -44,3 +51,3 @@ * </p> | ||
* @typedef {object} ModuleBundleDefinitionSection | ||
* @property {string} mode The embedding mode. Either 'provided', 'raw', 'preload' or 'require' | ||
* @property {string} mode The embedding mode. Either 'provided', 'raw', 'preload', 'require' or 'bundleInfo' | ||
* @property {string[]} filters List of modules declared as glob patterns (resource name patterns) that should be | ||
@@ -47,0 +54,0 @@ * in- or excluded. |
@@ -148,2 +148,3 @@ /** | ||
case "2.3": | ||
case "2.4": | ||
return baseInterface; | ||
@@ -150,0 +151,0 @@ default: |
{ | ||
"name": "@ui5/builder", | ||
"version": "2.8.4", | ||
"version": "2.9.0", | ||
"description": "UI5 Tooling - Builder", | ||
@@ -136,5 +136,5 @@ "author": { | ||
"docdash": "^1.2.0", | ||
"eslint": "^7.26.0", | ||
"eslint": "^7.27.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-jsdoc": "^34.6.1", | ||
"eslint-plugin-jsdoc": "^35.0.0", | ||
"extract-zip": "^2.0.1", | ||
@@ -145,3 +145,3 @@ "mock-require": "^3.0.3", | ||
"recursive-readdir": "^2.1.1", | ||
"sinon": "^10.0.0", | ||
"sinon": "^11.1.1", | ||
"tap-nyan": "^1.1.0", | ||
@@ -148,0 +148,0 @@ "tap-xunit": "^2.4.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
798541
20740