@ui5/builder 5.0.0-alpha.4 → 5.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/lib/lbt/bundle/Builder.js +3 -2
- package/lib/lbt/bundle/ResolvedBundleDefinition.js +1 -0
- package/lib/lbt/bundle/Resolver.js +20 -0
- package/lib/lbt/calls/SapUiDefine.js +1 -1
- package/lib/lbt/resources/ModuleInfo.js +2 -1
- package/lib/lbt/resources/ResourceFilterList.js +10 -0
- package/lib/lbt/resources/ResourcePool.js +5 -2
- package/lib/processors/bundlers/flexChangesBundler.js +17 -6
- package/lib/processors/jsdoc/jsdocGenerator.js +2 -1
- package/lib/processors/nonAsciiEscaper.js +1 -1
- package/lib/processors/stringReplacer.js +2 -1
- package/lib/tasks/buildThemes.js +1 -1
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +3 -1
- package/lib/tasks/escapeNonAsciiCharacters.js +10 -3
- package/lib/tasks/minify.js +21 -4
- package/lib/tasks/replaceBuildtime.js +21 -17
- package/lib/tasks/replaceCopyright.js +23 -17
- package/lib/tasks/replaceVersion.js +21 -16
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
|
4
4
|
|
|
5
5
|
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.0.11...HEAD).
|
|
6
6
|
|
|
7
|
+
## [5.0.0-alpha.5](https://github.com/UI5/cli/compare/builder-v5.0.0-alpha.4...builder-v5.0.0-alpha.5) (2026-06-24)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **builder:** Adapt build tasks for incremental builds ([ace5ebb](https://github.com/UI5/cli/commit/ace5ebb6bf10b7d72db6397460f12e9040121456))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **builder:** Also detect import.meta as ESM indicator ([5d1dcb7](https://github.com/UI5/cli/commit/5d1dcb719056eba85dc13271493baa8d5cbd1bd1))
|
|
18
|
+
* **builder:** Reduce noise from ESM parse errors ([4e7f69a](https://github.com/UI5/cli/commit/4e7f69aede38571dcd4643414ff54ab6131a5c73))
|
|
19
|
+
* **builder:** Skip ESM modules during bundling and log errors ([20bcdf2](https://github.com/UI5/cli/commit/20bcdf212c30569a6aba5c7c61d5717bfd9b1d0b))
|
|
20
|
+
* **builder:** Update lbt/bundle/Resolver to ensure deterministic ordering of raw modules ([9d19923](https://github.com/UI5/cli/commit/9d19923437f41f511cb51fb8477e7a2dec1f0d13))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
|
|
25
|
+
* Bump espree from 10.4.0 to 11.2.0 ([#1381](https://github.com/UI5/cli/issues/1381)) ([29a00b2](https://github.com/UI5/cli/commit/29a00b236e4c410e4a47ccb0842e851ff9e2ab4a))
|
|
26
|
+
* Update npm dependencies ([0ac8ebb](https://github.com/UI5/cli/commit/0ac8ebbb5ffe9fc6e4455244cf5da50e4c540c5c))
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @ui5/fs bumped from ^5.0.0-alpha.4 to ^5.0.0-alpha.5
|
|
30
|
+
* @ui5/logger bumped from ^5.0.0-alpha.4 to ^5.0.0-alpha.5
|
|
31
|
+
* devDependencies
|
|
32
|
+
* @ui5/project bumped from ^5.0.0-alpha.4 to ^5.0.0-alpha.5
|
|
33
|
+
|
|
7
34
|
## [5.0.0-alpha.4](https://github.com/UI5/cli/compare/builder-v5.0.0-alpha.3...builder-v5.0.0-alpha.4) (2026-03-24)
|
|
8
35
|
|
|
9
36
|
|
|
@@ -597,10 +597,11 @@ class BundleBuilder {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
writeRequires(section) {
|
|
600
|
+
async writeRequires(section) {
|
|
601
601
|
if (section.modules.length === 0) {
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
|
+
|
|
604
605
|
this.outW.ensureNewLine();
|
|
605
606
|
if (section.async === false) {
|
|
606
607
|
section.modules.forEach( (module) => {
|
|
@@ -767,7 +768,7 @@ async function rewriteDefine({moduleName, moduleContent, moduleSourceMap}) {
|
|
|
767
768
|
} catch (e) {
|
|
768
769
|
log.error(`Error while parsing ${moduleName}: ${e.message}`);
|
|
769
770
|
log.verbose(e.stack);
|
|
770
|
-
return
|
|
771
|
+
return null;
|
|
771
772
|
}
|
|
772
773
|
|
|
773
774
|
if ( ast.type === Syntax.Program &&
|
|
@@ -67,6 +67,7 @@ class ResolvedBundleDefinition {
|
|
|
67
67
|
return pool.getModuleInfo(submodule).then(
|
|
68
68
|
(subinfo) => {
|
|
69
69
|
if (!bundleInfo.subModules.includes(subinfo.name) &&
|
|
70
|
+
subinfo.format !== ModuleInfo.Format.ESM &&
|
|
70
71
|
(!subinfo.requiresTopLevelScope ||
|
|
71
72
|
(subinfo.requiresTopLevelScope && allowStringBundling))) {
|
|
72
73
|
bundleInfo.addSubModule(subinfo);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import topologicalSort from "../graph/topologicalSort.js";
|
|
6
6
|
import {getRendererName} from "../UI5ClientConstants.js";
|
|
7
|
+
import ModuleInfo from "../resources/ModuleInfo.js";
|
|
7
8
|
import ResourceFilterList from "../resources/ResourceFilterList.js";
|
|
8
9
|
import {SectionType} from "./BundleDefinition.js";
|
|
9
10
|
import ResolvedBundleDefinition from "./ResolvedBundleDefinition.js";
|
|
@@ -135,6 +136,16 @@ class BundleResolver {
|
|
|
135
136
|
const dependencyInfo = resource && resource.info;
|
|
136
137
|
let promises = [];
|
|
137
138
|
|
|
139
|
+
// Skip ESM modules — they can't be bundled
|
|
140
|
+
if (resource?.info?.format === ModuleInfo.Format.ESM) {
|
|
141
|
+
log.error(
|
|
142
|
+
`Module ${resourceName} is an ECMAScript Module (ESM), ` +
|
|
143
|
+
`which is not supported for bundling. ` +
|
|
144
|
+
`The module will be skipped.`
|
|
145
|
+
);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
138
149
|
if ( isBundle && !decomposable ) {
|
|
139
150
|
resource.info.subModules.forEach(
|
|
140
151
|
(included) => {
|
|
@@ -318,6 +329,15 @@ class BundleResolver {
|
|
|
318
329
|
return collectModulesForSection(section).
|
|
319
330
|
then( (modules) => {
|
|
320
331
|
if ( section.mode == SectionType.Raw && section.sort !== false ) {
|
|
332
|
+
// Sort modules by their filter definition order to ensure
|
|
333
|
+
// deterministic input for the topological sort.
|
|
334
|
+
// Topological sort preserves input order for tie-breaking,
|
|
335
|
+
// so this ensures modules at the same dependency level
|
|
336
|
+
// appear in the order defined by the section filters.
|
|
337
|
+
const filterOrder = new ResourceFilterList(section.filters, fileTypes);
|
|
338
|
+
modules.sort((a, b) => {
|
|
339
|
+
return filterOrder.matchIndex(a) - filterOrder.matchIndex(b);
|
|
340
|
+
});
|
|
321
341
|
// sort the modules in topological order
|
|
322
342
|
return topologicalSort(pool, modules).then( (modules) => {
|
|
323
343
|
log.silly(` Resolved modules (sorted): ${modules}`);
|
|
@@ -39,7 +39,7 @@ class SapUiDefineCall {
|
|
|
39
39
|
this.dependencies = this.dependencyArray.elements.map( (elem) => {
|
|
40
40
|
const value = getStringValue(elem);
|
|
41
41
|
if ( !value ) {
|
|
42
|
-
throw new TypeError();
|
|
42
|
+
throw new TypeError(`dependency element is not a string literal in module ${this.name}`);
|
|
43
43
|
}
|
|
44
44
|
return resolveRelativeRequireJSName(this.name, value);
|
|
45
45
|
});
|
|
@@ -124,6 +124,16 @@ export default class ResourceFilterList {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
matchIndex(candidate) {
|
|
128
|
+
for (let i = 0; i < this.matchers.length; i++) {
|
|
129
|
+
const matcher = this.matchers[i];
|
|
130
|
+
if (matcher.include && matcher.calcMatch(candidate, false)) {
|
|
131
|
+
return i;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return this.matchers.length;
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
toString() {
|
|
128
138
|
return this.matchers.map((matcher) => matcher.pattern).join(",");
|
|
129
139
|
}
|
|
@@ -62,8 +62,12 @@ async function determineDependencyInfo(resource, rawInfo, pool) {
|
|
|
62
62
|
try {
|
|
63
63
|
ast = parseJS(code, {comment: true});
|
|
64
64
|
} catch (err) {
|
|
65
|
-
log.
|
|
65
|
+
log.verbose(`Failed to parse ${resource.name}: ${err.message}`);
|
|
66
66
|
log.verbose(err.stack);
|
|
67
|
+
if (err.message.includes("'import' and 'export' may appear only with 'sourceType: module'") ||
|
|
68
|
+
err.message.includes("Cannot use 'import.meta' outside a module")) {
|
|
69
|
+
info.format = ModuleInfo.Format.ESM;
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
if (ast) {
|
|
69
73
|
try {
|
|
@@ -243,4 +247,3 @@ class ResourcePool {
|
|
|
243
247
|
}
|
|
244
248
|
|
|
245
249
|
export default ResourcePool;
|
|
246
|
-
|
|
@@ -18,8 +18,8 @@ import {createResource} from "@ui5/fs/resourceFactory";
|
|
|
18
18
|
* @param {@ui5/fs/Resource[]} parameters.resources List of resources to be processed
|
|
19
19
|
* @param {object} parameters.options Options
|
|
20
20
|
* @param {string} parameters.options.pathPrefix Prefix for bundle path
|
|
21
|
-
* @param {string} parameters.options.hasFlexBundleVersion true if minUI5Version >= 1.73
|
|
22
|
-
* create flexibility-bundle.json
|
|
21
|
+
* @param {string} parameters.options.hasFlexBundleVersion true if minUI5Version >= 1.73
|
|
22
|
+
* and create flexibility-bundle.json
|
|
23
23
|
* @param {object} [parameters.existingFlexBundle={}] Object with existing flexibility-bundle.json
|
|
24
24
|
* to merge with new changes
|
|
25
25
|
* @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with flex changes bundle resources
|
|
@@ -45,6 +45,7 @@ export default function({resources, options: {pathPrefix, hasFlexBundleVersion},
|
|
|
45
45
|
const variants = [];
|
|
46
46
|
const variantChanges = [];
|
|
47
47
|
const variantManagementChanges = [];
|
|
48
|
+
const annotationChanges = [];
|
|
48
49
|
|
|
49
50
|
changesContent.forEach(function(content) {
|
|
50
51
|
if (content.layer === "VENDOR") {
|
|
@@ -74,14 +75,23 @@ export default function({resources, options: {pathPrefix, hasFlexBundleVersion},
|
|
|
74
75
|
case "ctrl_variant_management_change":
|
|
75
76
|
variantManagementChanges.push(content);
|
|
76
77
|
break;
|
|
78
|
+
case "annotation_change":
|
|
79
|
+
annotationChanges.push(content);
|
|
80
|
+
break;
|
|
77
81
|
}
|
|
78
82
|
});
|
|
79
83
|
|
|
80
|
-
if (!hasFlexBundleVersion && (
|
|
81
|
-
|
|
84
|
+
if (!hasFlexBundleVersion && (
|
|
85
|
+
compVariants.length != 0 ||
|
|
86
|
+
variants.length != 0 ||
|
|
87
|
+
variantChanges.length != 0 ||
|
|
88
|
+
variantDependentControlChanges.length != 0 ||
|
|
89
|
+
variantManagementChanges.length != 0 ||
|
|
90
|
+
annotationChanges.length != 0
|
|
91
|
+
)) {
|
|
82
92
|
throw new Error(
|
|
83
|
-
"There are some
|
|
84
|
-
"
|
|
93
|
+
"There are some files in the changes folder supported only with a UI5 version 1.73 and above. " +
|
|
94
|
+
"Please update the minUI5Version in the manifest.json to 1.73 or higher");
|
|
85
95
|
}
|
|
86
96
|
// create changes-bundle.json
|
|
87
97
|
if (!hasFlexBundleVersion) {
|
|
@@ -89,6 +99,7 @@ export default function({resources, options: {pathPrefix, hasFlexBundleVersion},
|
|
|
89
99
|
} else {
|
|
90
100
|
bundleName = "flexibility-bundle.json";
|
|
91
101
|
let newChangeFormat = {
|
|
102
|
+
annotationChanges,
|
|
92
103
|
changes,
|
|
93
104
|
compVariants,
|
|
94
105
|
variants,
|
|
@@ -163,10 +163,11 @@ async function buildJsdoc({sourcePath, configPath}) {
|
|
|
163
163
|
"--verbose",
|
|
164
164
|
sourcePath
|
|
165
165
|
];
|
|
166
|
-
const exitCode = await new Promise((resolve
|
|
166
|
+
const exitCode = await new Promise((resolve, reject) => {
|
|
167
167
|
const child = spawn("node", args, {
|
|
168
168
|
stdio: ["ignore", "ignore", "inherit"]
|
|
169
169
|
});
|
|
170
|
+
child.on("error", reject);
|
|
170
171
|
child.on("close", resolve);
|
|
171
172
|
});
|
|
172
173
|
|
|
@@ -83,8 +83,8 @@ async function nonAsciiEscaper({resources, options: {encoding}}) {
|
|
|
83
83
|
// only modify the resource's string if it was changed
|
|
84
84
|
if (escaped.modified) {
|
|
85
85
|
resource.setString(escaped.string);
|
|
86
|
+
return resource;
|
|
86
87
|
}
|
|
87
|
-
return resource;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return Promise.all(resources.map(processResource));
|
|
@@ -21,9 +21,10 @@ export default function({resources, options: {pattern, replacement}}) {
|
|
|
21
21
|
return Promise.all(resources.map(async (resource) => {
|
|
22
22
|
const content = await resource.getString();
|
|
23
23
|
const newContent = content.replaceAll(pattern, replacement);
|
|
24
|
+
// only modify the resource's string if it was changed
|
|
24
25
|
if (content !== newContent) {
|
|
25
26
|
resource.setString(newContent);
|
|
27
|
+
return resource;
|
|
26
28
|
}
|
|
27
|
-
return resource;
|
|
28
29
|
}));
|
|
29
30
|
}
|
package/lib/tasks/buildThemes.js
CHANGED
|
@@ -192,7 +192,7 @@ export default async function({
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
let processedResources;
|
|
195
|
-
const useWorkers = !!taskUtil;
|
|
195
|
+
const useWorkers = !process.env.UI5_CLI_NO_WORKERS && !!taskUtil;
|
|
196
196
|
if (useWorkers) {
|
|
197
197
|
const threadMessageHandler = new FsMainThreadInterface(fsInterface(combo));
|
|
198
198
|
|
|
@@ -95,7 +95,9 @@ export default async function({workspace, taskUtil, options = {}}) {
|
|
|
95
95
|
|
|
96
96
|
log.verbose("Collecting flexibility changes");
|
|
97
97
|
const allResources = await workspace.byGlob(
|
|
98
|
-
|
|
98
|
+
pathPrefix + "/changes/*.{annotation_change,change,variant,ctrl_variant," +
|
|
99
|
+
"ctrl_variant_change,ctrl_variant_management_change}"
|
|
100
|
+
);
|
|
99
101
|
|
|
100
102
|
let bBundleCreated = false;
|
|
101
103
|
|
|
@@ -14,17 +14,24 @@ import nonAsciiEscaper from "../processors/nonAsciiEscaper.js";
|
|
|
14
14
|
*
|
|
15
15
|
* @param {object} parameters Parameters
|
|
16
16
|
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
17
|
+
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
|
|
18
|
+
* This is only set if a cache is used and changes have been detected.
|
|
17
19
|
* @param {object} parameters.options Options
|
|
18
20
|
* @param {string} parameters.options.pattern Glob pattern to locate the files to be processed
|
|
19
21
|
* @param {string} parameters.options.encoding source file encoding either "UTF-8" or "ISO-8859-1"
|
|
20
22
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
21
23
|
*/
|
|
22
|
-
export default async function({workspace, options: {pattern, encoding}}) {
|
|
24
|
+
export default async function({workspace, changedProjectResourcePaths, options: {pattern, encoding}}) {
|
|
23
25
|
if (!encoding) {
|
|
24
26
|
throw new Error("[escapeNonAsciiCharacters] Mandatory option 'encoding' not provided");
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
let allResources;
|
|
30
|
+
if (changedProjectResourcePaths) {
|
|
31
|
+
allResources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
|
|
32
|
+
} else {
|
|
33
|
+
allResources = await workspace.byGlob(pattern);
|
|
34
|
+
}
|
|
28
35
|
|
|
29
36
|
const processedResources = await nonAsciiEscaper({
|
|
30
37
|
resources: allResources,
|
|
@@ -33,5 +40,5 @@ export default async function({workspace, options: {pattern, encoding}}) {
|
|
|
33
40
|
}
|
|
34
41
|
});
|
|
35
42
|
|
|
36
|
-
await Promise.all(processedResources.map((resource) => workspace.write(resource)));
|
|
43
|
+
await Promise.all(processedResources.map((resource) => resource && workspace.write(resource)));
|
|
37
44
|
}
|
package/lib/tasks/minify.js
CHANGED
|
@@ -16,6 +16,8 @@ import fsInterface from "@ui5/fs/fsInterface";
|
|
|
16
16
|
* @param {object} parameters Parameters
|
|
17
17
|
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
18
18
|
* @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
|
|
19
|
+
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
|
|
20
|
+
* This is only set if a cache is used and changes have been detected.
|
|
19
21
|
* @param {object} parameters.options Options
|
|
20
22
|
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
|
|
21
23
|
* @param {boolean} [parameters.options.omitSourceMapResources=false] Whether source map resources shall
|
|
@@ -26,9 +28,24 @@ import fsInterface from "@ui5/fs/fsInterface";
|
|
|
26
28
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
27
29
|
*/
|
|
28
30
|
export default async function({
|
|
29
|
-
workspace, taskUtil,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
workspace, taskUtil, changedProjectResourcePaths,
|
|
32
|
+
options: {pattern, omitSourceMapResources = false, useInputSourceMaps = true}
|
|
33
|
+
}) {
|
|
34
|
+
let resources;
|
|
35
|
+
if (changedProjectResourcePaths) {
|
|
36
|
+
resources = await Promise.all(
|
|
37
|
+
changedProjectResourcePaths
|
|
38
|
+
// Filtering out non-JS resources such as .map files
|
|
39
|
+
// FIXME: The changed resources should rather be matched against the provided pattern
|
|
40
|
+
.filter((resourcePath) => resourcePath.endsWith(".js"))
|
|
41
|
+
.map((resource) => workspace.byPath(resource))
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
resources = await workspace.byGlob(pattern);
|
|
45
|
+
}
|
|
46
|
+
if (resources.length === 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
32
49
|
const processedResources = await minifier({
|
|
33
50
|
resources,
|
|
34
51
|
fs: fsInterface(workspace),
|
|
@@ -36,7 +53,7 @@ export default async function({
|
|
|
36
53
|
options: {
|
|
37
54
|
addSourceMappingUrl: !omitSourceMapResources,
|
|
38
55
|
readSourceMappingUrl: !!useInputSourceMaps,
|
|
39
|
-
useWorkers: !!taskUtil,
|
|
56
|
+
useWorkers: !process.env.UI5_CLI_NO_WORKERS && !!taskUtil,
|
|
40
57
|
}
|
|
41
58
|
});
|
|
42
59
|
|
|
@@ -28,26 +28,30 @@ function getTimestamp() {
|
|
|
28
28
|
*
|
|
29
29
|
* @param {object} parameters Parameters
|
|
30
30
|
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
31
|
+
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
|
|
32
|
+
* This is only set if a cache is used and changes have been detected.
|
|
31
33
|
* @param {object} parameters.options Options
|
|
32
34
|
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
|
|
33
35
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
34
36
|
*/
|
|
35
|
-
export default function({workspace, options: {pattern}}) {
|
|
37
|
+
export default async function({workspace, changedProjectResourcePaths, options: {pattern}}) {
|
|
38
|
+
let resources;
|
|
39
|
+
if (changedProjectResourcePaths) {
|
|
40
|
+
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
|
|
41
|
+
} else {
|
|
42
|
+
resources = await workspace.byGlob(pattern);
|
|
43
|
+
}
|
|
36
44
|
const timestamp = getTimestamp();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return Promise.all(processedResources.map((resource) => {
|
|
50
|
-
return workspace.write(resource);
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
45
|
+
const processedResources = await stringReplacer({
|
|
46
|
+
resources,
|
|
47
|
+
options: {
|
|
48
|
+
pattern: "${buildtime}",
|
|
49
|
+
replacement: timestamp
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return Promise.all(processedResources.map((resource) => {
|
|
53
|
+
if (resource) {
|
|
54
|
+
return workspace.write(resource);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
53
57
|
}
|
|
@@ -24,32 +24,38 @@ import stringReplacer from "../processors/stringReplacer.js";
|
|
|
24
24
|
*
|
|
25
25
|
* @param {object} parameters Parameters
|
|
26
26
|
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
27
|
+
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
|
|
28
|
+
* This is only set if a cache is used and changes have been detected.
|
|
27
29
|
* @param {object} parameters.options Options
|
|
28
30
|
* @param {string} parameters.options.copyright Replacement copyright
|
|
29
31
|
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
|
|
30
32
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
31
33
|
*/
|
|
32
|
-
export default function({workspace, options: {copyright, pattern}}) {
|
|
34
|
+
export default async function({workspace, changedProjectResourcePaths, options: {copyright, pattern}}) {
|
|
33
35
|
if (!copyright) {
|
|
34
|
-
return
|
|
36
|
+
return;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
// Replace optional placeholder ${currentYear} with the current year
|
|
38
40
|
copyright = copyright.replace(/(?:\$\{currentYear\})/, new Date().getFullYear());
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
let resources;
|
|
43
|
+
if (changedProjectResourcePaths) {
|
|
44
|
+
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
|
|
45
|
+
} else {
|
|
46
|
+
resources = await workspace.byGlob(pattern);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const processedResources = await stringReplacer({
|
|
50
|
+
resources,
|
|
51
|
+
options: {
|
|
52
|
+
pattern: /(?:\$\{copyright\}|@copyright@)/g,
|
|
53
|
+
replacement: copyright
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return Promise.all(processedResources.map((resource) => {
|
|
57
|
+
if (resource) {
|
|
58
|
+
return workspace.write(resource);
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
55
61
|
}
|
|
@@ -14,25 +14,30 @@ import stringReplacer from "../processors/stringReplacer.js";
|
|
|
14
14
|
*
|
|
15
15
|
* @param {object} parameters Parameters
|
|
16
16
|
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
17
|
+
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
|
|
18
|
+
* This is only set if a cache is used and changes have been detected.
|
|
17
19
|
* @param {object} parameters.options Options
|
|
18
20
|
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
|
|
19
21
|
* @param {string} parameters.options.version Replacement version
|
|
20
22
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
21
23
|
*/
|
|
22
|
-
export default function({workspace, options: {pattern, version}}) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
export default async function({workspace, changedProjectResourcePaths, options: {pattern, version}}) {
|
|
25
|
+
let resources;
|
|
26
|
+
if (changedProjectResourcePaths) {
|
|
27
|
+
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
|
|
28
|
+
} else {
|
|
29
|
+
resources = await workspace.byGlob(pattern);
|
|
30
|
+
}
|
|
31
|
+
const processedResources = await stringReplacer({
|
|
32
|
+
resources,
|
|
33
|
+
options: {
|
|
34
|
+
pattern: /\$\{(?:project\.)?version\}/g,
|
|
35
|
+
replacement: version
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
await Promise.all(processedResources.map((resource) => {
|
|
39
|
+
if (resource) {
|
|
40
|
+
return workspace.write(resource);
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
38
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"description": "UI5 CLI - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -91,32 +91,32 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
94
|
-
"@ui5/fs": "^5.0.0-alpha.
|
|
95
|
-
"@ui5/logger": "^5.0.0-alpha.
|
|
94
|
+
"@ui5/fs": "^5.0.0-alpha.5",
|
|
95
|
+
"@ui5/logger": "^5.0.0-alpha.5",
|
|
96
96
|
"cheerio": "1.0.0",
|
|
97
97
|
"escape-unicode": "^0.3.0",
|
|
98
98
|
"escope": "^4.0.0",
|
|
99
|
-
"espree": "^
|
|
99
|
+
"espree": "^11.2.0",
|
|
100
100
|
"graceful-fs": "^4.2.11",
|
|
101
|
-
"jsdoc": "^4.0.
|
|
101
|
+
"jsdoc": "^4.0.5",
|
|
102
102
|
"less-openui5": "^0.11.6",
|
|
103
103
|
"pretty-data": "^0.40.0",
|
|
104
|
-
"semver": "^7.
|
|
105
|
-
"terser": "^5.
|
|
106
|
-
"workerpool": "^10.0.
|
|
104
|
+
"semver": "^7.8.5",
|
|
105
|
+
"terser": "^5.48.0",
|
|
106
|
+
"workerpool": "^10.0.2",
|
|
107
107
|
"xml2js": "^0.6.2"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@istanbuljs/esm-loader-hook": "^0.3.0",
|
|
111
111
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
112
|
-
"@ui5/project": "^5.0.0-alpha.
|
|
112
|
+
"@ui5/project": "^5.0.0-alpha.5",
|
|
113
113
|
"ava": "^6.4.1",
|
|
114
114
|
"cross-env": "^10.1.0",
|
|
115
|
-
"eslint": "^
|
|
116
|
-
"esmock": "^2.7.
|
|
115
|
+
"eslint": "^10.5.0",
|
|
116
|
+
"esmock": "^2.7.6",
|
|
117
117
|
"line-column": "^1.0.2",
|
|
118
|
-
"nyc": "^
|
|
119
|
-
"rimraf": "^6.
|
|
120
|
-
"sinon": "^21.
|
|
118
|
+
"nyc": "^18.0.0",
|
|
119
|
+
"rimraf": "^6.1.3",
|
|
120
|
+
"sinon": "^21.1.2"
|
|
121
121
|
}
|
|
122
122
|
}
|