@ui5/builder 2.11.1 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,14 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.1...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.2...HEAD).
6
+
7
+ <a name="v2.11.2"></a>
8
+ ## [v2.11.2] - 2021-11-17
9
+ ### Bug Fixes
10
+ - **Builder:** Emit warning on bundleInfo name without extension [`ed0da12`](https://github.com/SAP/ui5-builder/commit/ed0da123ac084d126a28f0f34d9740c310d91902)
11
+ - **manifestCreator:** Trim whitespace/new-lines for sap.app/title [`019cfd7`](https://github.com/SAP/ui5-builder/commit/019cfd7031a2bd63ce93801ad027413151a3b060)
12
+
6
13
 
7
14
  <a name="v2.11.1"></a>
8
15
  ## [v2.11.1] - 2021-10-19
@@ -626,6 +633,7 @@ to load the custom bundle file instead.
626
633
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
627
634
 
628
635
 
636
+ [v2.11.2]: https://github.com/SAP/ui5-builder/compare/v2.11.1...v2.11.2
629
637
  [v2.11.1]: https://github.com/SAP/ui5-builder/compare/v2.11.0...v2.11.1
630
638
  [v2.11.0]: https://github.com/SAP/ui5-builder/compare/v2.10.0...v2.11.0
631
639
  [v2.10.0]: https://github.com/SAP/ui5-builder/compare/v2.9.5...v2.10.0
@@ -1,5 +1,7 @@
1
1
  const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
2
2
 
3
+ // Note: When adding standard tags, always update the public documentation in TaskUtil
4
+ // (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
3
5
  const STANDARD_TAGS = Object.freeze({
4
6
  OmitFromBuildResult: "ui5:OmitFromBuildResult",
5
7
  IsBundle: "ui5:IsBundle"
@@ -2,6 +2,7 @@
2
2
  // for consistency of write calls, we generally allow template literals
3
3
  "use strict";
4
4
 
5
+ const path = require("path");
5
6
  const terser = require("terser");
6
7
  const {pd} = require("pretty-data");
7
8
  const {parseJS, Syntax} = require("../utils/parseUtils");
@@ -486,6 +487,11 @@ class BundleBuilder {
486
487
  if (!section.name) {
487
488
  throw new Error(`A 'bundleInfo' section is missing the mandatory 'name' property.` );
488
489
  }
490
+ if (!path.extname(section.name)) {
491
+ log.warn(`bundleInfo section name '${section.name}' is missing a file extension. ` +
492
+ `The info might not work as expected. ` +
493
+ `The name must match the bundle filename (incl. extension such as '.js')`);
494
+ }
489
495
  this.outW.write(`"${section.name}":[${section.modules.map(makeStringLiteral).join(",")}]`);
490
496
  });
491
497
  this.outW.writeln();
@@ -237,7 +237,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
237
237
  if ( library.getDocumentation() ) {
238
238
  let desc = library.getDocumentation();
239
239
  // remove all tags
240
- desc = desc.replace(/\\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
240
+ desc = desc.replace(/\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
241
241
  // extract summary (first sentence)
242
242
  const m = /^([\w\W]+?[.;!?])[^a-zA-Z0-9_$]/.exec(desc);
243
243
  return m ? m[1] : desc;
@@ -20,6 +20,8 @@ class TaskUtil {
20
20
  * @typedef {object} module:@ui5/builder.tasks.TaskUtil~StandardBuildTags
21
21
  * @property {string} OmitFromBuildResult
22
22
  * Setting this tag to true for a resource will prevent it from being written to the build target
23
+ * @property {string} IsBundle
24
+ * This tag identifies resources that contain (i.e. bundle) multiple other resources
23
25
  */
24
26
 
25
27
  /**
@@ -280,59 +280,59 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
280
280
  return combo.byGlob("/**/*.{js,json,xml,html,properties,library}").then((resources) => {
281
281
  // Find all libraries and create a library-preload.js bundle
282
282
 
283
- let p;
283
+ let p = Promise.resolve();
284
284
 
285
- // Create sap-ui-core.js
286
- // TODO: move to config of actual core project
285
+ // Create core bundles for older versions (<1.97.0) which don't define bundle configuration in the ui5.yaml
286
+ // See: https://github.com/SAP/openui5/commit/ff127fd2d009162ea43ad312dec99d759ebc23a0
287
287
  if (projectName === "sap.ui.core") {
288
- // Filter out sap-ui-core.js from further uglification/replacement processors
289
- // to prevent them from overwriting it
290
- resources = resources.filter((resource) => {
291
- return resource.getPath() !== "/resources/sap-ui-core.js";
292
- });
293
-
294
- const isEvo = resources.find((resource) => {
295
- return resource.getPath() === "/resources/ui5loader.js";
296
- });
297
- let filters;
298
- if (isEvo) {
299
- filters = ["ui5loader-autoconfig.js"];
300
- } else {
301
- filters = ["jquery.sap.global.js"];
302
- }
303
-
304
- p = Promise.all([
305
- moduleBundler({
306
- options: getModuleBundlerOptions({name: "sap-ui-core.js", filters, preload: true}),
307
- resources
308
- }),
309
- moduleBundler({
310
- options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
311
- resources
312
- }),
313
- moduleBundler({
314
- options: getModuleBundlerOptions({
315
- name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
288
+ const coreProject = resources[0]._project;
289
+ const coreSpecVersion = coreProject && coreProject.specVersion;
290
+ // Instead of checking the sap.ui.core library version, the specVersion is checked against all versions
291
+ // that have been defined for sap.ui.core before the bundle configuration has been introduced.
292
+ // This is mainly to have an easier check without version parsing or using semver.
293
+ // If no project/specVersion is available, the bundles should also be created to not break potential
294
+ // existing use cases without a properly formed/formatted project tree.
295
+ if (!coreSpecVersion || ["0.1", "1.1", "2.0"].includes(coreSpecVersion)) {
296
+ const isEvo = resources.find((resource) => {
297
+ return resource.getPath() === "/resources/ui5loader.js";
298
+ });
299
+ let filters;
300
+ if (isEvo) {
301
+ filters = ["ui5loader-autoconfig.js"];
302
+ } else {
303
+ filters = ["jquery.sap.global.js"];
304
+ }
305
+ p = Promise.all([
306
+ moduleBundler({
307
+ options: getModuleBundlerOptions({name: "sap-ui-core.js", filters, preload: true}),
308
+ resources
316
309
  }),
317
- resources
318
- }),
319
- moduleBundler({
320
- options: getModuleBundlerOptions({
321
- name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
310
+ moduleBundler({
311
+ options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
312
+ resources
322
313
  }),
323
- resources
324
- }),
325
- ]).then((results) => {
326
- const bundles = Array.prototype.concat.apply([], results);
327
- return Promise.all(bundles.map((bundle) => {
328
- if (taskUtil) {
329
- taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
330
- }
331
- return workspace.write(bundle);
332
- }));
333
- });
334
- } else {
335
- p = Promise.resolve();
314
+ moduleBundler({
315
+ options: getModuleBundlerOptions({
316
+ name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
317
+ }),
318
+ resources
319
+ }),
320
+ moduleBundler({
321
+ options: getModuleBundlerOptions({
322
+ name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
323
+ }),
324
+ resources
325
+ }),
326
+ ]).then((results) => {
327
+ const bundles = Array.prototype.concat.apply([], results);
328
+ return Promise.all(bundles.map((bundle) => {
329
+ if (taskUtil) {
330
+ taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
331
+ }
332
+ return workspace.write(bundle);
333
+ }));
334
+ });
335
+ }
336
336
  }
337
337
 
338
338
  return p.then(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "2.11.1",
3
+ "version": "2.11.2",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -134,7 +134,7 @@
134
134
  "docdash": "^1.2.0",
135
135
  "eslint": "^7.32.0",
136
136
  "eslint-config-google": "^0.14.0",
137
- "eslint-plugin-jsdoc": "^36.1.1",
137
+ "eslint-plugin-jsdoc": "^37.0.3",
138
138
  "extract-zip": "^2.0.1",
139
139
  "mock-require": "^3.0.3",
140
140
  "nyc": "^15.1.0",