-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move applyDefaults to external util & adjust tests
- Loading branch information
Showing
10 changed files
with
511 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
lib/tasks/bundlers/utils/applyDefaultsToBundleDefinition.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Applies default values to bundleDefinitions | ||
* | ||
* @param {module:@ui5/builder/processors/bundlers/moduleBundler~ModuleBundleDefinition} bundleDefinition Module | ||
* bundle definition | ||
* @param {@ui5/project/build/helpers/TaskUtil|object} [taskUtil] TaskUtil | ||
* | ||
* @returns {module:@ui5/builder/processors/bundlers/moduleBundler~ModuleBundleDefinition} | ||
*/ | ||
export function applyDefaultsToBundleDefinition(bundleDefinition, taskUtil) { | ||
bundleDefinition.sections = bundleDefinition?.sections?.map((section) => { | ||
const defaultValues = { | ||
resolve: false, | ||
resolveConditional: false, | ||
renderer: false, | ||
sort: true, | ||
declareRawModules: false, | ||
}; | ||
|
||
// Since specVersion: 4.0 "require" section starts loading asynchronously. | ||
// If specVersion cannot be determined, the latest spec is taken into account. | ||
// This is a breaking change in specVersion: 4.0 | ||
if (section.mode === "require" && (!taskUtil || taskUtil.getProject().getSpecVersion().gte("4.0"))) { | ||
defaultValues.async = true; | ||
} | ||
|
||
return Object.assign(defaultValues, section); | ||
}); | ||
|
||
return bundleDefinition; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.