Skip to content

Commit 059d1e5

Browse files
committed
refactor(builder): Use only /resources of sap.ui.core for library preload generation
1 parent dd80238 commit 059d1e5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

packages/builder/lib/tasks/bundlers/generateLibraryPreload.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ export default async function({workspace, taskUtil, options: {skipBundles = [],
271271
return moduleBundler({options, resources});
272272
};
273273

274-
return nonDbgWorkspace.byGlob("/**/*.{js,json,xml,html,properties,library,js.map}").then(async (resources) => {
274+
return nonDbgWorkspace.byGlob(
275+
"/resources/**/*.{js,json,xml,html,properties,library,js.map}"
276+
).then(async (resources) => {
275277
// Find all libraries and create a library-preload.js bundle
276278

277279
let p = Promise.resolve();
@@ -299,8 +301,8 @@ export default async function({workspace, taskUtil, options: {skipBundles = [],
299301
return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
300302
}
301303
});
302-
unoptimizedResources =
303-
await unoptimizedWorkspace.byGlob("/**/*.{js,json,xml,html,properties,library,js.map}");
304+
unoptimizedResources = await unoptimizedWorkspace.byGlob(
305+
"/resources/**/*.{js,json,xml,html,properties,library,js.map}");
304306

305307
unoptimizedModuleNameMapping = createModuleNameMapping({
306308
resources: unoptimizedResources,

packages/builder/test/lib/tasks/bundlers/generateLibraryPreload.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ test.serial("generateLibraryPreload", async (t) => {
150150

151151
t.is(workspace.byGlob.callCount, 2,
152152
"workspace.byGlob should have been called twice");
153-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
153+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
154154
"workspace.byGlob should have been called with expected pattern");
155155
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/.library"],
156156
"workspace.byGlob should have been called with expected pattern");
@@ -461,7 +461,7 @@ test.serial("generateLibraryPreload for sap.ui.core (w/o ui5loader.js)", async (
461461

462462
t.is(workspace.byGlob.callCount, 2,
463463
"workspace.byGlob should have been called twice");
464-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
464+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
465465
"workspace.byGlob should have been called with expected pattern");
466466
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/.library"],
467467
"workspace.byGlob should have been called with expected pattern");
@@ -521,9 +521,9 @@ test.serial("generateLibraryPreload for sap.ui.core (/w ui5loader.js)", async (t
521521

522522
t.is(workspace.byGlob.callCount, 3,
523523
"workspace.byGlob should have been called three times");
524-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
524+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
525525
"workspace.byGlob should have been called with expected pattern");
526-
t.deepEqual(workspace.byGlob.getCall(1).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
526+
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
527527
"workspace.byGlob should have been called with expected pattern");
528528
t.deepEqual(workspace.byGlob.getCall(2).args, ["/resources/**/.library"],
529529
"workspace.byGlob should have been called with expected pattern");
@@ -947,9 +947,9 @@ test.serial("generateLibraryPreload for sap.ui.core with old specVersion defined
947947

948948
t.is(workspace.byGlob.callCount, 3,
949949
"workspace.byGlob should have been called three times");
950-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
950+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
951951
"workspace.byGlob should have been called with expected pattern");
952-
t.deepEqual(workspace.byGlob.getCall(1).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
952+
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
953953
"workspace.byGlob should have been called with expected pattern");
954954
t.deepEqual(workspace.byGlob.getCall(2).args, ["/resources/**/.library"],
955955
"workspace.byGlob should have been called with expected pattern");
@@ -1486,7 +1486,7 @@ test.serial("generateLibraryPreload for sap.ui.core with own bundle configuratio
14861486

14871487
t.is(workspace.byGlob.callCount, 2,
14881488
"workspace.byGlob should have been called twice");
1489-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
1489+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
14901490
"workspace.byGlob should have been called with expected pattern");
14911491
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/.library"],
14921492
"workspace.byGlob should have been called with expected pattern");
@@ -1677,7 +1677,7 @@ test.serial("generateLibraryPreload for sap.ui.core with own bundle configuratio
16771677

16781678
t.is(workspace.byGlob.callCount, 2,
16791679
"workspace.byGlob should have been called twice");
1680-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
1680+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
16811681
"workspace.byGlob should have been called with expected pattern");
16821682
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/.library"],
16831683
"workspace.byGlob should have been called with expected pattern");
@@ -1805,7 +1805,7 @@ test.serial("generateLibraryPreload with excludes", async (t) => {
18051805

18061806
t.is(workspace.byGlob.callCount, 2,
18071807
"workspace.byGlob should have been called twice");
1808-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
1808+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
18091809
"workspace.byGlob should have been called with expected pattern");
18101810
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/.library"],
18111811
"workspace.byGlob should have been called with expected pattern");
@@ -1939,9 +1939,9 @@ test.serial("generateLibraryPreload for sap.ui.core (/w ui5loader.js), UI5 Versi
19391939

19401940
t.is(workspace.byGlob.callCount, 3,
19411941
"workspace.byGlob should have been called three times");
1942-
t.deepEqual(workspace.byGlob.getCall(0).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
1942+
t.deepEqual(workspace.byGlob.getCall(0).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
19431943
"workspace.byGlob should have been called with expected pattern");
1944-
t.deepEqual(workspace.byGlob.getCall(1).args, ["/**/*.{js,json,xml,html,properties,library,js.map}"],
1944+
t.deepEqual(workspace.byGlob.getCall(1).args, ["/resources/**/*.{js,json,xml,html,properties,library,js.map}"],
19451945
"workspace.byGlob should have been called with expected pattern");
19461946
t.deepEqual(workspace.byGlob.getCall(2).args, ["/resources/**/.library"],
19471947
"workspace.byGlob should have been called with expected pattern");

0 commit comments

Comments
 (0)