Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ui5/builder

Package Overview
Dependencies
Maintainers
4
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui5/builder - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

lib/lbt/utils/escapePropertiesFile.js

12

CHANGELOG.md

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

A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v1.3.3...HEAD).
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v1.4.0...HEAD).
<a name="v1.4.0"></a>
## [v1.4.0] - 2019-07-29
### Bug Fixes
- **versionInfo:** Use correct buildTimestamp format [`6d87b3e`](https://github.com/SAP/ui5-builder/commit/6d87b3e10db11a8755b4049ba82732c6ec4f776c)
### Features
- Properties File Escaping ([#293](https://github.com/SAP/ui5-builder/issues/293)) [`9d213ce`](https://github.com/SAP/ui5-builder/commit/9d213ced942ed7832fbb7b50f9d444f441941f35)
<a name="v1.3.3"></a>

@@ -216,2 +225,3 @@ ## [v1.3.3] - 2019-07-01

[v1.4.0]: https://github.com/SAP/ui5-builder/compare/v1.3.3...v1.4.0
[v1.3.3]: https://github.com/SAP/ui5-builder/compare/v1.3.2...v1.3.3

@@ -218,0 +228,0 @@ [v1.3.2]: https://github.com/SAP/ui5-builder/compare/v1.3.1...v1.3.2

@@ -22,2 +22,3 @@ /**

resourceCopier: require("./lib/processors/resourceCopier"),
nonAsciiEscaper: require("./lib/processors/nonAsciiEscaper"),
stringReplacer: require("./lib/processors/stringReplacer"),

@@ -47,2 +48,3 @@ themeBuilder: require("./lib/processors/themeBuilder"),

generateVersionInfo: require("./lib/tasks/generateVersionInfo"),
escapeNonAsciiCharacters: require("./lib/tasks/escapeNonAsciiCharacters"),
replaceCopyright: require("./lib/tasks/replaceCopyright"),

@@ -49,0 +51,0 @@ replaceVersion: require("./lib/tasks/replaceVersion"),

10

lib/lbt/bundle/AutoSplitter.js

@@ -5,4 +5,6 @@ "use strict";

const {pd} = require("pretty-data");
const ModuleName = require("../utils/ModuleName");
const {SectionType} = require("./BundleDefinition");
const escapePropertiesFile = require("../utils/escapePropertiesFile");
const log = require("@ui5/logger").getLogger("lbt:bundle:AutoSplitter");

@@ -221,3 +223,2 @@

} else if ( /\.properties$/.test(module) ) {
const fileContent = await resource.buffer();
/* NODE-TODO minimize *.properties

@@ -231,3 +232,8 @@ Properties props = new Properties();

*/
return fileContent.toString("latin1").length;
// Since AutoSplitter is also used when splitting non-project resources (e.g. dependencies)
// *.properties files should be escaped if encoding option is specified
const fileContent = await escapePropertiesFile(resource);
return fileContent.length;
} else if ( this.optimizeXMLViews && /\.view.xml$/.test(module) ) {

@@ -234,0 +240,0 @@ // needs to be activated when it gets activated in JSMergedModuleBuilderExt

@@ -15,2 +15,3 @@ /* eslint quotes: ["error", "double", { "allowTemplateLiterals": true }] */

const UI5ClientConstants = require("../UI5ClientConstants");
const escapePropertiesFile = require("../utils/escapePropertiesFile");

@@ -446,5 +447,7 @@ const BundleResolver = require("./Resolver");

} else if ( /\.properties$/.test(module) ) {
// same as for other text files, but input encoding is ISO_8859_1
const fileContent = await resource.buffer();
outW.write( makeStringLiteral( fileContent.toString("latin1") ) );
// Since the Builder is also used when building non-project resources (e.g. dependencies)
// *.properties files should be escaped if encoding option is specified
const fileContent = await escapePropertiesFile(resource);
outW.write( makeStringLiteral( fileContent ) );
} else {

@@ -451,0 +454,0 @@ log.error("don't know how to embed module " + module); // TODO throw?

@@ -19,2 +19,6 @@ const BundleBuilder = require("../../lbt/bundle/Builder");

}
getProject() {
return this.resource._project;
}
}

@@ -21,0 +25,0 @@

const resourceFactory = require("@ui5/fs").resourceFactory;
function pad(v) {
return String(v).padStart(2, "0");
}
function getTimestamp() {
const date = new Date();
const year = date.getFullYear();
const month = pad(date.getMonth() + 1);
const day = pad(date.getDate());
const hours = pad(date.getHours());
const minutes = pad(date.getMinutes());
// yyyyMMddHHmm
return year + month + day + hours + minutes;
}
/**

@@ -21,3 +35,3 @@ * Creates sap-ui-version.json.

const buildTimestamp = new Date().getTime();
const buildTimestamp = getTimestamp();
const versionJson = {

@@ -24,0 +38,0 @@ name: options.rootProjectName,

@@ -5,2 +5,3 @@ const tasks = {

createDebugFiles: require("./createDebugFiles"),
escapeNonAsciiCharacters: require("./escapeNonAsciiCharacters"),
executeJsdocSdkTransformation: require("./jsdoc/executeJsdocSdkTransformation"),

@@ -7,0 +8,0 @@ generateApiIndex: require("./jsdoc/generateApiIndex"),

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

generateCachebusterInfo: require("../../tasks/generateCachebusterInfo"),
escapeNonAsciiCharacters: require("../../tasks/escapeNonAsciiCharacters"),
buildThemes: require("../../tasks/buildThemes"),

@@ -30,2 +31,15 @@ createDebugFiles: require("../../tasks/createDebugFiles"),

this.addTask("escapeNonAsciiCharacters", () => {
const propertiesFileSourceEncoding = project.resources
&& project.resources.configuration
&& project.resources.configuration.propertiesFileSourceEncoding;
return tasks.escapeNonAsciiCharacters({
workspace: resourceCollections.workspace,
options: {
encoding: propertiesFileSourceEncoding,
pattern: "/**/*.properties"
}
});
});
this.addTask("replaceCopyright", () => {

@@ -32,0 +46,0 @@ return tasks.replaceCopyright({

@@ -136,2 +136,11 @@ const log = require("@ui5/logger").getLogger("types:application:ApplicationFormatter");

// default encoding to "ISO-8859-1" if not specified
if (!project.resources.configuration.propertiesFileSourceEncoding) {
project.resources.configuration.propertiesFileSourceEncoding = "ISO-8859-1";
}
if (!["ISO-8859-1", "UTF-8"].includes(project.resources.configuration.propertiesFileSourceEncoding)) {
throw new Error(`Invalid properties file encoding specified for project ${project.id}: ` +
`encoding provided: ${project.resources.configuration.propertiesFileSourceEncoding}. Must be either "ISO-8859-1" or "UTF-8".`);
}
const absolutePath = path.join(project.path, project.resources.configuration.paths.webapp);

@@ -138,0 +147,0 @@ return this.dirExists(absolutePath).then((bExists) => {

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

generateStandaloneAppBundle: require("../../tasks/bundlers/generateStandaloneAppBundle"),
escapeNonAsciiCharacters: require("../../tasks/escapeNonAsciiCharacters"),
buildThemes: require("../../tasks/buildThemes"),

@@ -29,2 +30,15 @@ createDebugFiles: require("../../tasks/createDebugFiles"),

this.addTask("escapeNonAsciiCharacters", () => {
const propertiesFileSourceEncoding = project.resources
&& project.resources.configuration
&& project.resources.configuration.propertiesFileSourceEncoding;
return tasks.escapeNonAsciiCharacters({
workspace: resourceCollections.workspace,
options: {
encoding: propertiesFileSourceEncoding,
pattern: "/**/*.properties"
}
});
});
this.addTask("replaceCopyright", () => {

@@ -31,0 +45,0 @@ const replaceCopyright = tasks.replaceCopyright;

@@ -343,2 +343,11 @@ const log = require("@ui5/logger").getLogger("types:library:LibraryFormatter");

// default encoding to "ISO-8859-1" if not specified
if (!project.resources.configuration.propertiesFileSourceEncoding) {
project.resources.configuration.propertiesFileSourceEncoding = "ISO-8859-1";
}
if (!["ISO-8859-1", "UTF-8"].includes(project.resources.configuration.propertiesFileSourceEncoding)) {
throw new Error(`Invalid properties file encoding specified for project ${project.id}: ` +
`encoding provided: ${project.resources.configuration.propertiesFileSourceEncoding}. Must be either "ISO-8859-1" or "UTF-8".`);
}
const absoluteSrcPath = path.join(project.path, project.resources.configuration.paths.src);

@@ -345,0 +354,0 @@ const absoluteTestPath = path.join(project.path, project.resources.configuration.paths.test);

{
"name": "@ui5/builder",
"version": "1.3.3",
"version": "1.4.0",
"description": "UI5 Tooling - Builder",

@@ -32,3 +32,3 @@ "author": "SAP SE (https://www.sap.com)",

"coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
"jsdoc": "npm run jsdoc-generate && opn jsdocs/index.html",
"jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
"jsdoc-generate": "node_modules/.bin/jsdoc -c ./jsdoc.json ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",

@@ -63,2 +63,3 @@ "preversion": "npm test",

"exclude": [
".eslintrc.js",
"docs/**",

@@ -104,2 +105,3 @@ "jsdocs/**",

"cheerio": "^0.22.0",
"escape-unicode": "^0.2.0",
"escodegen": "^1.11.1",

@@ -109,3 +111,3 @@ "escope": "^3.6.0",

"estraverse": "^4.2.0",
"globby": "^10.0.0",
"globby": "^10.0.1",
"graceful-fs": "^4.2.0",

@@ -119,3 +121,3 @@ "jsdoc": "3.5.5",

"rimraf": "^2.6.3",
"semver": "^6.1.2",
"semver": "^6.3.0",
"slash": "^3.0.0",

@@ -127,6 +129,6 @@ "uglify-es": "^3.2.2",

"devDependencies": {
"ava": "^2.1.0",
"ava": "^2.2.0",
"chai": "^4.1.2",
"chai-fs": "^2.0.0",
"coveralls": "^3.0.4",
"coveralls": "^3.0.5",
"cross-env": "^5.1.1",

@@ -140,3 +142,3 @@ "docdash": "^1.1.1",

"nyc": "^14.1.1",
"opn-cli": "^4.1.0",
"open-cli": "^5.0.0",
"recursive-readdir": "^2.1.1",

@@ -143,0 +145,0 @@ "sinon": "^7.3.2",

@@ -13,43 +13,5 @@ ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/master/docs/images/UI5_logo_wide.png)

**⌨️ CLI reference can be found [here!](https://github.com/SAP/ui5-cli#cli-usage)**
## Documentation
Can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/pages/Builder/)
## Builder
### Types
Types define how a project can be configured and how it is built. A type orchestrates a set of tasks and defines the order in which they get applied during build phase. Furthermore, it takes care of formatting and validating the project-specific configuration.
Also see [UI5 Project: Configuration](https://github.com/SAP/ui5-project/blob/master/docs/Configuration.md#root)
#### `application`
Projects of type `application` are typically the main or root project. In a projects dependency tree, there should only be one project of type `application`. If multiple are found, those further away from the root are ignored.
The source directory of an application (typically named `webapp`) is mapped to the virtual root path `/`.
An applications source directory may or may not contain a `Component.js` file. If it does, it must also contain a `manifest.json` file. If there is a `Component.js` file, an optimized `Component-preload.js` file will be generated during the build.
#### `library`
UI5 libraries are often referred to as reuse-, custom- or [control libraries](https://github.com/SAP/openui5/blob/master/docs/controllibraries.md). They are a key component in sharing code across multiple projects in UI5.
A project of type `library` must have a source directory (typically named `src`). It may also feature a "test" directory. These directories are mapped to the virtual directories `/resources` for the sources and `/test-resources` for the test resources. These directories should contain a directory structure representing the namespace of the library (e.g. `src/my/first/library`) to prevent name clashes between the resources of different libraries.
#### `module`
The `module` type is meant for usage with non-UI5 resources like third party libraries. Their path mapping can be configured freely. During a build, their resources are copied without modifications.
### Tasks
Tasks are specific build steps to be executed during build phase.
They are responsible for collecting resources which can be modified by a processor. A task configures one or more processors and supplies them with the collected resources. After the respective processor processed the resources, the task is able to continue with its workflow.
Available tasks are listed [here](lib/tasks).
### Processors
Processors work with provided resources. They contain the actual build step logic to apply specific modifications to supplied resources, or to make use of the resources' content to create new resources out of that.
Processors can be implemented generically. The string replacer is an example for that.
Since string replacement is a common build step, it can be useful in different contexts, e.g. code, version, date, and copyright replacement. A concrete replacement operation could be achieved by passing a custom configuration to the processor. This way, multiple tasks can make use of the same processor to achieve their build step.
Available processors are listed [here](lib/processors).
### Legacy Bundle Tooling (lbt)
JavaScript port of the "legacy" Maven/Java based bundle tooling.
## Contributing

@@ -56,0 +18,0 @@ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md).

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc