@ui5/builder 4.1.5 → 4.1.6

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,10 +2,18 @@
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/v4.1.5...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.1.6...HEAD).
6
+
7
+ <a name="v4.1.6"></a>
8
+ ## [v4.1.6] - 2026-04-08
9
+ ### Bug Fixes
10
+ - **Bundler:** Also detect import.meta as ESM indicator [`58013d5`](https://github.com/SAP/ui5-builder/commit/58013d5a75e3fbf245b0042fb0b81f4e729a7a55)
11
+ - **Bundler:** Skip ESM modules during bundling and log errors [`d28f63a`](https://github.com/SAP/ui5-builder/commit/d28f63a6ace823d9fcfac23312c09e66be6fb7d4)
12
+ - **Bundler:** Reduce noise from ESM parse errors [`bd574bb`](https://github.com/SAP/ui5-builder/commit/bd574bb231cc4e5f1af0b12c12c3365dee5eb80d)
13
+
6
14
 
7
15
  <a name="v4.1.5"></a>
8
- ## [v4.1.5] - 2026-03-23
16
+ ## [v4.1.5] - 2026-03-25
9
17
 
10
18
  <a name="v4.1.4"></a>
11
19
  ## [v4.1.4] - 2026-02-16
@@ -1019,6 +1027,7 @@ to load the custom bundle file instead.
1019
1027
 
1020
1028
  ### Features
1021
1029
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
1030
+ [v4.1.6]: https://github.com/SAP/ui5-builder/compare/v4.1.5...v4.1.6
1022
1031
  [v4.1.5]: https://github.com/SAP/ui5-builder/compare/v4.1.4...v4.1.5
1023
1032
  [v4.1.4]: https://github.com/SAP/ui5-builder/compare/v4.1.3...v4.1.4
1024
1033
  [v4.1.3]: https://github.com/SAP/ui5-builder/compare/v4.1.2...v4.1.3
@@ -597,10 +597,11 @@ class BundleBuilder {
597
597
  }
598
598
  }
599
599
 
600
- writeRequires(section) {
600
+ async writeRequires(section) {
601
601
  if (section.modules.length === 0) {
602
602
  return;
603
603
  }
604
+
604
605
  this.outW.ensureNewLine();
605
606
  if (section.async === false) {
606
607
  section.modules.forEach( (module) => {
@@ -767,7 +768,7 @@ async function rewriteDefine({moduleName, moduleContent, moduleSourceMap}) {
767
768
  } catch (e) {
768
769
  log.error(`Error while parsing ${moduleName}: ${e.message}`);
769
770
  log.verbose(e.stack);
770
- return {};
771
+ return null;
771
772
  }
772
773
 
773
774
  if ( ast.type === Syntax.Program &&
@@ -67,6 +67,7 @@ class ResolvedBundleDefinition {
67
67
  return pool.getModuleInfo(submodule).then(
68
68
  (subinfo) => {
69
69
  if (!bundleInfo.subModules.includes(subinfo.name) &&
70
+ subinfo.format !== ModuleInfo.Format.ESM &&
70
71
  (!subinfo.requiresTopLevelScope ||
71
72
  (subinfo.requiresTopLevelScope && allowStringBundling))) {
72
73
  bundleInfo.addSubModule(subinfo);
@@ -4,6 +4,7 @@
4
4
 
5
5
  import topologicalSort from "../graph/topologicalSort.js";
6
6
  import {getRendererName} from "../UI5ClientConstants.js";
7
+ import ModuleInfo from "../resources/ModuleInfo.js";
7
8
  import ResourceFilterList from "../resources/ResourceFilterList.js";
8
9
  import {SectionType} from "./BundleDefinition.js";
9
10
  import ResolvedBundleDefinition from "./ResolvedBundleDefinition.js";
@@ -135,6 +136,16 @@ class BundleResolver {
135
136
  const dependencyInfo = resource && resource.info;
136
137
  let promises = [];
137
138
 
139
+ // Skip ESM modules — they can't be bundled
140
+ if (resource?.info?.format === ModuleInfo.Format.ESM) {
141
+ log.error(
142
+ `Module ${resourceName} is an ECMAScript Module (ESM), ` +
143
+ `which is not supported for bundling. ` +
144
+ `The module will be skipped.`
145
+ );
146
+ return;
147
+ }
148
+
138
149
  if ( isBundle && !decomposable ) {
139
150
  resource.info.subModules.forEach(
140
151
  (included) => {
@@ -25,7 +25,8 @@ const CONDITIONAL = 2;
25
25
  const Format = {
26
26
  UI5_LEGACY: "ui5-declare",
27
27
  UI5_DEFINE: "ui5-define",
28
- AMD: "amd"
28
+ AMD: "amd",
29
+ ESM: "esm"
29
30
  };
30
31
 
31
32
  /**
@@ -62,8 +62,12 @@ async function determineDependencyInfo(resource, rawInfo, pool) {
62
62
  try {
63
63
  ast = parseJS(code, {comment: true});
64
64
  } catch (err) {
65
- log.error(`Failed to parse ${resource.name}: ${err.message}`);
65
+ log.verbose(`Failed to parse ${resource.name}: ${err.message}`);
66
66
  log.verbose(err.stack);
67
+ if (err.message.includes("'import' and 'export' may appear only with 'sourceType: module'") ||
68
+ err.message.includes("Cannot use 'import.meta' outside a module")) {
69
+ info.format = ModuleInfo.Format.ESM;
70
+ }
67
71
  }
68
72
  if (ast) {
69
73
  try {
@@ -243,4 +247,3 @@ class ResourcePool {
243
247
  }
244
248
 
245
249
  export default ResourcePool;
246
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "description": "UI5 CLI - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -142,7 +142,7 @@
142
142
  "@eslint/js": "^9.14.0",
143
143
  "@istanbuljs/esm-loader-hook": "^0.3.0",
144
144
  "@jridgewell/trace-mapping": "^0.3.31",
145
- "@ui5/project": "^4.0.14",
145
+ "@ui5/project": "^4.0.15",
146
146
  "ava": "^6.4.1",
147
147
  "chokidar-cli": "^3.0.0",
148
148
  "cross-env": "^10.1.0",
@@ -158,7 +158,7 @@
158
158
  "nyc": "^17.1.0",
159
159
  "open-cli": "^8.0.0",
160
160
  "rimraf": "^6.1.3",
161
- "sinon": "^21.0.3",
161
+ "sinon": "^21.1.2",
162
162
  "tap-xunit": "^2.4.1"
163
163
  }
164
164
  }