diff --git a/test/expected/build/application.a/dest-deps/resources/library/d/legacy-dbg.js b/test/expected/build/application.a/dest-deps/resources/library/d/legacy-dbg.js
new file mode 100644
index 000000000..dc97b0e1f
--- /dev/null
+++ b/test/expected/build/application.a/dest-deps/resources/library/d/legacy-dbg.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar = "Old World";
+console.log('Hello ' + topLevelVar);
diff --git a/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js b/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js
new file mode 100644
index 000000000..8238eb084
--- /dev/null
+++ b/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar="Old World";console.log("Hello "+topLevelVar);
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js.map b/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js.map
new file mode 100644
index 000000000..aa09f6e3c
--- /dev/null
+++ b/test/expected/build/application.a/dest-deps/resources/library/d/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","names":["topLevelVar","console","log"],"sources":["legacy-dbg.js"],"mappings":";;;AAGA,IAAIA,YAAc,YAClBC,QAAQC,IAAI,SAAWF"}
\ No newline at end of file
diff --git a/test/expected/build/application.a/dest-depself/resources/library/d/legacy-dbg.js b/test/expected/build/application.a/dest-depself/resources/library/d/legacy-dbg.js
new file mode 100644
index 000000000..dc97b0e1f
--- /dev/null
+++ b/test/expected/build/application.a/dest-depself/resources/library/d/legacy-dbg.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar = "Old World";
+console.log('Hello ' + topLevelVar);
diff --git a/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js b/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js
new file mode 100644
index 000000000..8238eb084
--- /dev/null
+++ b/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar="Old World";console.log("Hello "+topLevelVar);
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js.map b/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js.map
new file mode 100644
index 000000000..aa09f6e3c
--- /dev/null
+++ b/test/expected/build/application.a/dest-depself/resources/library/d/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","names":["topLevelVar","console","log"],"sources":["legacy-dbg.js"],"mappings":";;;AAGA,IAAIA,YAAc,YAClBC,QAAQC,IAAI,SAAWF"}
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/.library b/test/expected/build/library.d-minified/preload/resources/library/d/.library
new file mode 100644
index 000000000..d6a612a92
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/.library
@@ -0,0 +1,11 @@
+
+
+
+ library.d
+ SAP SE
+ Some fancy copyright
+ 1.0.0
+
+ Library D
+
+
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js b/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js
new file mode 100644
index 000000000..8238eb084
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar="Old World";console.log("Hello "+topLevelVar);
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js.map b/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js.map
new file mode 100644
index 000000000..aa09f6e3c
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","names":["topLevelVar","console","log"],"sources":["legacy-dbg.js"],"mappings":";;;AAGA,IAAIA,YAAc,YAClBC,QAAQC,IAAI,SAAWF"}
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js b/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js
new file mode 100644
index 000000000..49f446c4b
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js
@@ -0,0 +1,12 @@
+//@ui5-bundle library/d/library-preload.js
+sap.ui.require.preload({
+ "library/d/legacy.js":'/*!\n * Some fancy copyright\n */\nvar topLevelVar="Old World";console.log("Hello "+topLevelVar);\n//# sourceMappingURL=legacy.js.map',
+ "library/d/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"library.d","type":"library","embeds":[],"applicationVersion":{"version":"1.0.0"},"title":"Library D","description":"Library D","resources":"resources.json","offline":true},"sap.ui":{"technology":"UI5","supportedThemes":[]},"sap.ui5":{"dependencies":{"minUI5Version":"1.0","libs":{}},"library":{"i18n":false}}}',
+ "library/d/some.js":function(){
+/*!
+ * Some fancy copyright
+ */
+(function(){var o="World";console.log("Hello "+o)})();
+}
+});
+//# sourceMappingURL=library-preload.js.map
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js.map b/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js.map
new file mode 100644
index 000000000..7b8addb56
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/library-preload.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"library-preload.js","sections":[{"offset":{"line":1,"column":0},"map":{"version":3,"sources":["library-preload.js?bundle-code-0"],"mappings":"AAAA;AACA","sourcesContent":["sap.ui.require.preload({\n"],"sourceRoot":""}},{"offset":{"line":5,"column":0},"map":{"version":3,"file":"some.js","names":["someNonUglifiedVariable","console","log"],"sources":["some-dbg.js"],"mappings":"AAAA;;;CAGA,WACC,IAAIA,EAA0B,QAC9BC,QAAQC,IAAI,SAAWF,EACvB,EAHD","sourceRoot":""}}]}
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/manifest.json b/test/expected/build/library.d-minified/preload/resources/library/d/manifest.json
new file mode 100644
index 000000000..c4f9b3baa
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/manifest.json
@@ -0,0 +1,28 @@
+{
+ "_version": "1.21.0",
+ "sap.app": {
+ "id": "library.d",
+ "type": "library",
+ "embeds": [],
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "title": "Library D",
+ "description": "Library D",
+ "resources": "resources.json",
+ "offline": true
+ },
+ "sap.ui": {
+ "technology": "UI5",
+ "supportedThemes": []
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.0",
+ "libs": {}
+ },
+ "library": {
+ "i18n": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/some.js b/test/expected/build/library.d-minified/preload/resources/library/d/some.js
new file mode 100644
index 000000000..75aba1e23
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/some.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+(function(){var o="World";console.log("Hello "+o)})();
+//# sourceMappingURL=some.js.map
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/resources/library/d/some.js.map b/test/expected/build/library.d-minified/preload/resources/library/d/some.js.map
new file mode 100644
index 000000000..8f900826d
--- /dev/null
+++ b/test/expected/build/library.d-minified/preload/resources/library/d/some.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"some.js","names":["someNonUglifiedVariable","console","log"],"sources":["some-dbg.js"],"mappings":";;;CAGA,WACC,IAAIA,EAA0B,QAC9BC,QAAQC,IAAI,SAAWF,EACvB,EAHD"}
\ No newline at end of file
diff --git a/test/expected/build/library.d-minified/preload/test-resources/library/d/Test.html b/test/expected/build/library.d-minified/preload/test-resources/library/d/Test.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/expected/build/library.d/dest/resources/library/d/legacy-dbg.js b/test/expected/build/library.d/dest/resources/library/d/legacy-dbg.js
new file mode 100644
index 000000000..dc97b0e1f
--- /dev/null
+++ b/test/expected/build/library.d/dest/resources/library/d/legacy-dbg.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar = "Old World";
+console.log('Hello ' + topLevelVar);
diff --git a/test/expected/build/library.d/dest/resources/library/d/legacy.js b/test/expected/build/library.d/dest/resources/library/d/legacy.js
new file mode 100644
index 000000000..8238eb084
--- /dev/null
+++ b/test/expected/build/library.d/dest/resources/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar="Old World";console.log("Hello "+topLevelVar);
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/test/expected/build/library.d/dest/resources/library/d/legacy.js.map b/test/expected/build/library.d/dest/resources/library/d/legacy.js.map
new file mode 100644
index 000000000..aa09f6e3c
--- /dev/null
+++ b/test/expected/build/library.d/dest/resources/library/d/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","names":["topLevelVar","console","log"],"sources":["legacy-dbg.js"],"mappings":";;;AAGA,IAAIA,YAAc,YAClBC,QAAQC,IAAI,SAAWF"}
\ No newline at end of file
diff --git a/test/expected/build/library.d/preload/resources/library/d/legacy.js b/test/expected/build/library.d/preload/resources/library/d/legacy.js
new file mode 100644
index 000000000..d4a7b26fd
--- /dev/null
+++ b/test/expected/build/library.d/preload/resources/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * ${copyright}
+ */
+var topLevelVar = "Old World";
+console.log('Hello ' + topLevelVar);
diff --git a/test/expected/build/library.d/preload/resources/library/d/library-preload.js b/test/expected/build/library.d/preload/resources/library/d/library-preload.js
index 4a740e861..39e436d58 100644
--- a/test/expected/build/library.d/preload/resources/library/d/library-preload.js
+++ b/test/expected/build/library.d/preload/resources/library/d/library-preload.js
@@ -1,5 +1,6 @@
//@ui5-bundle library/d/library-preload.js
sap.ui.require.preload({
+ "library/d/legacy.js":'/*!\n * ${copyright}\n */\nvar topLevelVar = "Old World";\nconsole.log(\'Hello \' + topLevelVar);\n',
"library/d/some.js":function(){
/*!
* ${copyright}
diff --git a/test/expected/build/library.d/preload/resources/library/d/library-preload.js.map b/test/expected/build/library.d/preload/resources/library/d/library-preload.js.map
index fe612c788..3df80a410 100644
--- a/test/expected/build/library.d/preload/resources/library/d/library-preload.js.map
+++ b/test/expected/build/library.d/preload/resources/library/d/library-preload.js.map
@@ -1 +1 @@
-{"version":3,"file":"library-preload.js","sections":[{"offset":{"line":1,"column":0},"map":{"version":3,"sources":["library-preload.js?bundle-code-0"],"mappings":"AAAA;AACA","sourcesContent":["sap.ui.require.preload({\n"],"sourceRoot":""}},{"offset":{"line":3,"column":0},"map":{"version":3,"sources":["some.js"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourceRoot":""}}]}
\ No newline at end of file
+{"version":3,"file":"library-preload.js","sections":[{"offset":{"line":1,"column":0},"map":{"version":3,"sources":["library-preload.js?bundle-code-0"],"mappings":"AAAA;AACA","sourcesContent":["sap.ui.require.preload({\n"],"sourceRoot":""}},{"offset":{"line":4,"column":0},"map":{"version":3,"sources":["some.js"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourceRoot":""}}]}
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/src/library/d/.library b/test/fixtures/library.d-minified/main/src/library/d/.library
new file mode 100644
index 000000000..d6a612a92
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/.library
@@ -0,0 +1,11 @@
+
+
+
+ library.d
+ SAP SE
+ Some fancy copyright
+ 1.0.0
+
+ Library D
+
+
diff --git a/test/fixtures/library.d-minified/main/src/library/d/legacy.js b/test/fixtures/library.d-minified/main/src/library/d/legacy.js
new file mode 100644
index 000000000..8238eb084
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+var topLevelVar="Old World";console.log("Hello "+topLevelVar);
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/src/library/d/legacy.js.map b/test/fixtures/library.d-minified/main/src/library/d/legacy.js.map
new file mode 100644
index 000000000..aa09f6e3c
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","names":["topLevelVar","console","log"],"sources":["legacy-dbg.js"],"mappings":";;;AAGA,IAAIA,YAAc,YAClBC,QAAQC,IAAI,SAAWF"}
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/src/library/d/manifest.json b/test/fixtures/library.d-minified/main/src/library/d/manifest.json
new file mode 100644
index 000000000..c4f9b3baa
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/manifest.json
@@ -0,0 +1,28 @@
+{
+ "_version": "1.21.0",
+ "sap.app": {
+ "id": "library.d",
+ "type": "library",
+ "embeds": [],
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "title": "Library D",
+ "description": "Library D",
+ "resources": "resources.json",
+ "offline": true
+ },
+ "sap.ui": {
+ "technology": "UI5",
+ "supportedThemes": []
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.0",
+ "libs": {}
+ },
+ "library": {
+ "i18n": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/src/library/d/some.js b/test/fixtures/library.d-minified/main/src/library/d/some.js
new file mode 100644
index 000000000..75aba1e23
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/some.js
@@ -0,0 +1,5 @@
+/*!
+ * Some fancy copyright
+ */
+(function(){var o="World";console.log("Hello "+o)})();
+//# sourceMappingURL=some.js.map
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/src/library/d/some.js.map b/test/fixtures/library.d-minified/main/src/library/d/some.js.map
new file mode 100644
index 000000000..8f900826d
--- /dev/null
+++ b/test/fixtures/library.d-minified/main/src/library/d/some.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"some.js","names":["someNonUglifiedVariable","console","log"],"sources":["some-dbg.js"],"mappings":";;;CAGA,WACC,IAAIA,EAA0B,QAC9BC,QAAQC,IAAI,SAAWF,EACvB,EAHD"}
\ No newline at end of file
diff --git a/test/fixtures/library.d-minified/main/test/library/d/Test.html b/test/fixtures/library.d-minified/main/test/library/d/Test.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/fixtures/library.d/main/src/library/d/legacy.js b/test/fixtures/library.d/main/src/library/d/legacy.js
new file mode 100644
index 000000000..d4a7b26fd
--- /dev/null
+++ b/test/fixtures/library.d/main/src/library/d/legacy.js
@@ -0,0 +1,5 @@
+/*!
+ * ${copyright}
+ */
+var topLevelVar = "Old World";
+console.log('Hello ' + topLevelVar);
diff --git a/test/lib/tasks/bundlers/generateLibraryPreload.integration.js b/test/lib/tasks/bundlers/generateLibraryPreload.integration.js
index 62b3a9df0..d64d9fc68 100644
--- a/test/lib/tasks/bundlers/generateLibraryPreload.integration.js
+++ b/test/lib/tasks/bundlers/generateLibraryPreload.integration.js
@@ -13,6 +13,7 @@ import * as taskRepository from "../../../../lib/tasks/taskRepository.js";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const libraryDPath = path.join(__dirname, "..", "..", "..", "fixtures", "library.d");
+const libraryDMinifiedPath = path.join(__dirname, "..", "..", "..", "fixtures", "library.d-minified");
const sapUiCorePath = path.join(__dirname, "..", "..", "..", "fixtures", "sap.ui.core");
import recursive from "recursive-readdir";
@@ -51,7 +52,7 @@ test.serial("integration: build library.d with library preload", async (t) => {
assert.directoryDeepEqual(destPath, expectedPath);
// Check for all file contents
- t.is(expectedFiles.length, 5, "5 files are expected");
+ t.is(expectedFiles.length, 6, "6 files are expected");
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
@@ -82,6 +83,59 @@ const libraryDTree = {
}
};
+test.serial("integration: build library.d-minified with library preload", async (t) => {
+ const destPath = "./test/tmp/build/library.d-minified/preload";
+ const expectedPath = "./test/expected/build/library.d-minified/preload";
+ const excludedTasks = ["*"];
+ const includedTasks = ["generateLibraryPreload"];
+
+ const graph = await graphFromObject({
+ dependencyTree: libraryDMinifiedTree
+ });
+ graph.setTaskRepository(taskRepository);
+ await t.notThrowsAsync(graph.build({
+ destPath,
+ excludedTasks,
+ includedTasks
+ }));
+
+ const expectedFiles = await findFiles(expectedPath);
+
+ // Check for all directories and files
+ assert.directoryDeepEqual(destPath, expectedPath);
+
+ // Check for all file contents
+ t.is(expectedFiles.length, 9, "9 files are expected");
+ expectedFiles.forEach((expectedFile) => {
+ const relativeFile = path.relative(expectedPath, expectedFile);
+ const destFile = path.join(destPath, relativeFile);
+ assert.fileEqual(destFile, expectedFile);
+ });
+});
+
+const libraryDMinifiedTree = {
+ "id": "library.d",
+ "version": "1.0.0",
+ "path": libraryDMinifiedPath,
+ "dependencies": [],
+ "configuration": {
+ "specVersion": "2.0",
+ "type": "library",
+ "metadata": {
+ "name": "library.d",
+ "copyright": "Some fancy copyright"
+ },
+ "resources": {
+ "configuration": {
+ "paths": {
+ "src": "main/src",
+ "test": "main/test"
+ }
+ }
+ }
+ }
+};
+
test.serial("integration: build sap.ui.core with library preload", async (t) => {
const destPath = "./test/tmp/build/sap.ui.core/preload";
const expectedPath = "./test/expected/build/sap.ui.core/preload";