Socket
Socket
Sign inDemoInstall

@ui5/builder

Package Overview
Dependencies
143
Maintainers
4
Versions
138
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6

10

CHANGELOG.md

@@ -5,4 +5,11 @@ # Changelog

A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...HEAD).
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...HEAD).
<a name="v3.0.0-alpha.6"></a>
## [v3.0.0-alpha.6] - 2022-04-26
### Bug Fixes
- **JSModuleAnalyzer:** Fix detection of bundle name ([#705](https://github.com/SAP/ui5-builder/issues/705)) [`aaeafd4`](https://github.com/SAP/ui5-builder/commit/aaeafd4a1fd194dd08e5ae47c29d90f0b4c7d197)
- **generateResourcesJson:** Add raw-module info for debug bundles ([#736](https://github.com/SAP/ui5-builder/issues/736)) [`3b918e8`](https://github.com/SAP/ui5-builder/commit/3b918e83bfd38342778ecd4c58e648e99ad7cffc)
<a name="v3.0.0-alpha.5"></a>

@@ -718,2 +725,3 @@ ## [v3.0.0-alpha.5] - 2022-04-14

[v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
[v3.0.0-alpha.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.4...v3.0.0-alpha.5

@@ -720,0 +728,0 @@ [v3.0.0-alpha.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.3...v3.0.0-alpha.4

@@ -304,2 +304,5 @@ "use strict";

// Module name via @ui5-bundle comment in first line. Overrides all other main module candidates.
let firstLineBundleName;
// first analyze the whole AST...

@@ -318,3 +321,8 @@ visit(ast, false);

const bundleName = comment.value.slice("@ui5-bundle ".length);
setMainModuleInfo(bundleName, null);
if (comment.start === 0) {
// Remember the name from the first line to use it as final name
firstLineBundleName = bundleName;
} else {
setMainModuleInfo(bundleName, null);
}
log.verbose(`bundle name directive ${bundleName}`);

@@ -329,3 +337,6 @@ } else {

// ...and finally take conclusions about the file's content
if ( !mainModuleFound ) {
if ( firstLineBundleName ) {
// If the first line has a bundle name, use it and override all other found names
info.name = firstLineBundleName;
} else if ( !mainModuleFound ) {
// if there's exactly one module definition in this file but it didn't

@@ -332,0 +343,0 @@ // immediately qualify as main module, make it now the main module

37

lib/lbt/resources/ResourceCollector.js

@@ -113,6 +113,7 @@ const ResourceInfoList = require("./ResourceInfoList");

async enrichWithDependencyInfo(resourceInfo) {
return this._pool.getModuleInfo(resourceInfo.name).then(async (moduleInfo) => {
if ( moduleInfo.name ) {
return this._pool.getModuleInfo(resourceInfo.name, resourceInfo.module).then(async (moduleInfo) => {
if ( !resourceInfo.module && moduleInfo.name ) {
resourceInfo.module = moduleInfo.name;
}
if ( moduleInfo.dynamicDependencies ) {

@@ -283,7 +284,5 @@ resourceInfo.dynRequired = true;

const debugBundlePromises = [];
for (let i = debugResourcesInfo.length - 1; i >= 0; i--) {
const dbgInfo = debugResourcesInfo[i];
const nonDebugName = ResourceInfoList.getNonDebugName(dbgInfo.name);
await Promise.all(debugResourcesInfo.map(async (dbgInfo) => {
const debugName = dbgInfo.name;
const nonDebugName = ResourceInfoList.getNonDebugName(debugName);
const nonDbgInfo = this._resources.get(nonDebugName);

@@ -293,8 +292,16 @@

// Therefore using the same logic here to compute it.
// TODO: Idea: Use IsDebugVariant tag to decide whether to analyze the resource
// If the tag is set, we don't expect different analysis results so we can copy the info (else-path)
// Only when the tag is not set, we analyze the resource with its name (incl. -dbg)
if (!nonDbgInfo || (nonDbgInfo.included != null && nonDbgInfo.included.size > 0)) {
// We need to analyze the dbg resource if there is no non-dbg variant or
// it is a bundle because we will (usually) have different content.
debugBundlePromises.push(
this.enrichWithDependencyInfo(dbgInfo)
);
if (nonDbgInfo) {
// Always use the non-debug module name, if available
dbgInfo.module = nonDbgInfo.module;
}
await this.enrichWithDependencyInfo(dbgInfo);
} else {

@@ -304,3 +311,3 @@ // If the non-dbg resource is not a bundle, we can just copy over the info and skip

const newDbgInfo = new ResourceInfo(dbgInfo.name);
const newDbgInfo = new ResourceInfo(debugName);

@@ -311,8 +318,8 @@ // First copy info of analysis from non-dbg file (included, required, condRequired, ...)

newDbgInfo.copyFrom(null, dbgInfo);
// Finally, set the module name to the non-dbg name
newDbgInfo.module = nonDbgInfo.module;
this._resources.set(dbgInfo.name, newDbgInfo);
this._resources.set(debugName, newDbgInfo);
}
}
await Promise.all(debugBundlePromises);
}));
}

@@ -319,0 +326,0 @@

@@ -51,3 +51,2 @@ const ResourceInfo = require("./ResourceInfo");

myInfo.size = info.size;
myInfo.module = ResourceInfoList.getNonDebugName(info.name);
this.resources.push(myInfo);

@@ -54,0 +53,0 @@ this.resourcesByName.set(relativeName, myInfo);

@@ -179,13 +179,14 @@ "use strict";

*
* @param {string} name module name
* @param {string} resourceName resource/module name
* @param {string} [moduleName] module name, in case it differs from the resource name (e.g. for -dbg resources)
* @returns {Promise<ModuleInfo>}
*/
async getModuleInfo(name) {
let info = this._dependencyInfos.get(name);
async getModuleInfo(resourceName, moduleName) {
let info = this._dependencyInfos.get(resourceName);
if ( info == null ) {
info = Promise.resolve().then(async () => {
const resource = await this.findResource(name);
return determineDependencyInfo( resource, this._rawModuleInfos.get(name), this );
const resource = await this.findResource(resourceName);
return determineDependencyInfo( resource, this._rawModuleInfos.get(moduleName || resourceName), this );
});
this._dependencyInfos.set(name, info);
this._dependencyInfos.set(resourceName, info);
}

@@ -192,0 +193,0 @@ return info;

@@ -5,3 +5,2 @@ "use strict";

const manifestCreator = require("../processors/manifestCreator");
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;

@@ -16,3 +15,2 @@

* @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
* @param {object} parameters.options Options

@@ -22,7 +20,3 @@ * @param {string} parameters.options.projectName Project name

*/
module.exports = function({workspace, dependencies, options: {projectName}}) {
const combo = new ReaderCollectionPrioritized({
name: `libraryManifestGenerator - prioritize workspace over dependencies: ${projectName}`,
readers: [workspace, dependencies]
});
module.exports = function({workspace, options: {projectName}}) {
// Note:

@@ -34,3 +28,3 @@ // *.library files are needed to identify libraries

// *.properties to identify existence of i18n bundles (e.g. messagebundle.properties)
return combo.byGlob("/**/*.{js,json,library,less,css,theming,theme,properties}").then((resources) => {
return workspace.byGlob("/resources/**/*.{js,json,library,less,css,theming,theme,properties}").then((resources) => {
// Find all libraries and create a manifest.json file

@@ -37,0 +31,0 @@ return workspace.byGlob("/resources/**/.library").then((libraryIndicatorResources) => {

@@ -115,3 +115,2 @@ const AbstractBuilder = require("../AbstractBuilder");

workspace: resourceCollections.workspace,
dependencies: resourceCollections.dependencies,
taskUtil,

@@ -118,0 +117,0 @@ options: {

{
"name": "@ui5/builder",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.6",
"description": "UI5 Tooling - Builder",

@@ -108,3 +108,3 @@ "author": {

"dependencies": {
"@ui5/fs": "^3.0.0-alpha.2",
"@ui5/fs": "^3.0.0-alpha.3",
"@ui5/logger": "^3.0.1-alpha.1",

@@ -111,0 +111,0 @@ "cheerio": "1.0.0-rc.9",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc